@osdk/generator 0.0.10 → 0.0.11

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # @osdk/generator
2
2
 
3
+ ## 0.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 11ac931: Adding groupBy for Array types, using primary keys for actions and queries, and re-exporting more types
8
+ - 25de57b: Small fixes
9
+ - Updated dependencies [11ac931]
10
+ - Updated dependencies [25de57b]
11
+ - @osdk/api@0.0.13
12
+ - @osdk/gateway@0.0.6
13
+
3
14
  ## 0.0.10
4
15
 
5
16
  ### Patch Changes
package/build/js/index.js CHANGED
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
27
27
  var j__namespace = /*#__PURE__*/_interopNamespace(j);
28
28
  var ce__default = /*#__PURE__*/_interopDefault(ce);
29
29
 
30
- function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.apiName)}))}}function ie(e){return e.replace(/-./g,r=>r[1].toUpperCase())}function w(e){let r=new Set,o=new Set;for(let t of e.operations)switch(t.type){case"createObject":r.add(t.objectTypeApiName);break;case"modifyObject":o.add(t.objectTypeApiName);break;}return {addedObjects:r,modifiedObjects:o}}function c(e){return prettier.format(e,{parser:"typescript",singleQuote:!0,trailingComma:"all",plugins:[ce__default.default],tabWidth:2,printWidth:120})}async function Q(e,r,o){let t=new Set,a=[];for(let n of e.actionTypes){let s=Object.entries(n.parameters),y=w(n),m=Array.from(y.addedObjects),l=Array.from(y.modifiedObjects);m.forEach(t.add,t),l.forEach(t.add,t);let i=["/**"];n.description&&i.push(`* ${n.description}`);let p="";if(s.length>0){p=`params: {
30
+ function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.apiName)}))}}function ie(e){return e.replace(/-./g,r=>r[1].toUpperCase())}function $(e){let r=new Set,o=new Set;for(let t of e.operations)switch(t.type){case"createObject":r.add(t.objectTypeApiName);break;case"modifyObject":o.add(t.objectTypeApiName);break;}return {addedObjects:r,modifiedObjects:o}}function c(e){return prettier.format(e,{parser:"typescript",singleQuote:!0,trailingComma:"all",plugins:[ce__default.default],tabWidth:2,printWidth:120})}async function Q(e,r,o){let t=new Set,a=[];for(let n of e.actionTypes){let s=Object.entries(n.parameters),y=$(n),m=Array.from(y.addedObjects),l=Array.from(y.modifiedObjects);m.forEach(t.add,t),l.forEach(t.add,t);let i=["/**"];n.description&&i.push(`* ${n.description}`);let p="";if(s.length>0){p=`params: {
31
31
  `;for(let[f,b]of s){p+=`"${f}"`,p+=b.required?": ":"?: ";let E=P(b.dataType,t);p+=`${E};
32
32
  `,i.push(`* @param {${E}} params.${f}`);}p+="}, ";}i.push("*/"),a.push(`
33
33
  ${i.join(`
@@ -41,7 +41,7 @@ function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.
41
41
  ${a.join(`
42
42
  `)}
43
43
  }
44
- `));}function P(e,r){switch(e.type){case"objectSet":{let t=e.objectTypeApiName;return r.add(t),`ObjectSet<${t}>`}case"object":{let t=e.objectTypeApiName;return r.add(t),`${t}`}case"array":return `Array<${P(e.subType,r)}>`;case"string":return "string";case"boolean":return "boolean";case"attachment":return "Attachment";case"date":return "LocalDate";case"double":case"integer":case"long":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported action parameter type: ${e}`)}}async function v(e,r){await e.writeFile(j__namespace.default.join(r,"FoundryClient.ts"),await c(`
44
+ `));}function P(e,r){switch(e.type){case"objectSet":{let t=e.objectTypeApiName;return r.add(t),`ObjectSet<${t}>`}case"object":{let t=e.objectTypeApiName;return r.add(t),`${t} | ${t}["__primaryKey"]`}case"array":return `Array<${P(e.subType,r)}>`;case"string":return "string";case"boolean":return "boolean";case"attachment":return "Attachment";case"date":return "LocalDate";case"double":case"integer":case"long":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported action parameter type: ${e}`)}}async function v(e,r){await e.writeFile(j__namespace.default.join(r,"FoundryClient.ts"),await c(`
45
45
  import { BaseFoundryClient } from "@osdk/legacy-client";
46
46
  import type { Auth, FoundryClientOptions } from "@osdk/legacy-client";
47
47
  import { Ontology } from "./Ontology";
@@ -123,7 +123,7 @@ function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.
123
123
  } from '@osdk/legacy-client';
124
124
  export { Ontology } from "./Ontology";
125
125
  export { FoundryClient } from "./FoundryClient";
126
- `));}function $(e,r){return e.map(o=>{let t=r?.get(o);return t?`${o}: ${t}`:o}).join(",")}function h(e,r){return e.map(o=>`${o}: typeof ${r?.get(o)??o}`).join(",")}async function I(e,r,o){let t=Object.keys(e.objectTypes),a=e.actionTypes.map(i=>i.apiName),n=e.queryTypes.map(i=>i.apiName),s=new Map,y=new Map,m=new Set(t);for(let i of a)m.has(i)?s.set(i,`${i}Action`):m.add(i);for(let i of n)m.has(i)&&y.set(i,`${i}Query`);let l=(i,p)=>{let f=p.get(i);return f?`${i} as ${f}`:i};await r.writeFile(j__namespace.default.join(o,"Ontology.ts"),await c(`
126
+ `));}function w(e,r){return e.map(o=>{let t=r?.get(o);return t?`${o}: ${t}`:o}).join(",")}function h(e,r){return e.map(o=>`${o}: typeof ${r?.get(o)??o}`).join(",")}async function I(e,r,o){let t=Object.keys(e.objectTypes),a=e.actionTypes.map(i=>i.apiName),n=e.queryTypes.map(i=>i.apiName),s=new Map,y=new Map,m=new Set(t);for(let i of a)m.has(i)?s.set(i,`${i}Action`):m.add(i);for(let i of n)m.has(i)&&y.set(i,`${i}Query`);let l=(i,p)=>{let f=p.get(i);return f?`${i} as ${f}`:i};await r.writeFile(j__namespace.default.join(o,"Ontology.ts"),await c(`
127
127
  import type { OntologyDefinition } from "@osdk/api";
128
128
  import type { Ontology as ClientOntology } from "@osdk/legacy-client";
129
129
  import type { Objects } from "./ontology/objects/Objects";
@@ -158,13 +158,13 @@ function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.
158
158
  userAgent: "foundry-typescript-osdk/0.0.1" as const,
159
159
  },
160
160
  objects: {
161
- ${$(t)}
161
+ ${w(t)}
162
162
  },
163
163
  actions: {
164
- ${$(a,s)}
164
+ ${w(a,s)}
165
165
  },
166
166
  queries: {
167
- ${$(n,y)}
167
+ ${w(n,y)}
168
168
  }
169
169
  } satisfies OntologyDefinition<${t.map(i=>`"${i}"`).join("|")}, ${e.actionTypes.map(i=>`"${i.apiName}"`).join("|")}, ${e.queryTypes.map(i=>`"${i.apiName}"`).join("|")}>;
170
170
 
@@ -183,10 +183,10 @@ export interface Ontology extends ClientOntology<typeof Ontology> {
183
183
  }
184
184
  ;`));}async function M(e,r){await e.mkdir(r,{recursive:!0}),await e.writeFile(j__namespace.join(r,"index.ts"),await c(`
185
185
  export type { ObjectSet } from "@osdk/legacy-client";
186
- `));}function q(e){let r=w(e);return {apiName:e.apiName,parameters:Object.fromEntries(Object.entries(e.parameters).map(([o,t])=>[o,ue(t)])),displayName:e.displayName,description:e.description,modifiedEntities:fe(r.addedObjects,r.modifiedObjects)}}function ue(e){switch(e.dataType.type){case"string":case"boolean":case"object":case"attachment":case"date":case"double":case"integer":case"long":case"objectSet":case"timestamp":return {multiplicity:!1,type:A(e.dataType),nullable:!e.required,description:e.description};case"array":return {multiplicity:!0,type:A(e.dataType),nullable:!e.required,description:e.description}}}function A(e){switch(e.type){case"string":case"boolean":case"attachment":case"double":case"integer":case"long":case"timestamp":return e.type;case"date":return "datetime";case"objectSet":return {type:"objectSet",objectSet:e.objectTypeApiName};case"object":return {type:"object",object:e.objectTypeApiName};case"array":return A(e.subType)}}function fe(e,r){let o={};for(let t of e)o[t]={created:!0,modified:!1};for(let t of r)o[t]?o[t].modified=!0:o[t]={created:!1,modified:!0};return o}async function K(e,r,o){await r.mkdir(o,{recursive:!0}),await Promise.all(e.actionTypes.map(async t=>{let a=new Set(de(t));await r.writeFile(j__namespace.default.join(o,`${t.apiName}.ts`),await c(`
186
+ `));}function _(e){let r=$(e);return {apiName:e.apiName,parameters:Object.fromEntries(Object.entries(e.parameters).map(([o,t])=>[o,ue(t)])),displayName:e.displayName,description:e.description,modifiedEntities:fe(r.addedObjects,r.modifiedObjects)}}function ue(e){switch(e.dataType.type){case"string":case"boolean":case"object":case"attachment":case"date":case"double":case"integer":case"long":case"objectSet":case"timestamp":return {multiplicity:!1,type:A(e.dataType),nullable:!e.required,description:e.description};case"array":return {multiplicity:!0,type:A(e.dataType),nullable:!e.required,description:e.description}}}function A(e){switch(e.type){case"string":case"boolean":case"attachment":case"double":case"integer":case"long":case"timestamp":return e.type;case"date":return "datetime";case"objectSet":return {type:"objectSet",objectSet:e.objectTypeApiName};case"object":return {type:"object",object:e.objectTypeApiName};case"array":return A(e.subType)}}function fe(e,r){let o={};for(let t of e)o[t]={created:!0,modified:!1};for(let t of r)o[t]?o[t].modified=!0:o[t]={created:!1,modified:!0};return o}async function K(e,r,o){await r.mkdir(o,{recursive:!0}),await Promise.all(e.actionTypes.map(async t=>{let a=new Set(de(t));await r.writeFile(j__namespace.default.join(o,`${t.apiName}.ts`),await c(`
187
187
  import { ActionDefinition } from "@osdk/api";
188
188
 
189
- export const ${t.apiName} = ${JSON.stringify(q(t),null,2)} satisfies ActionDefinition<"${t.apiName}", ${a.size>0?[...a].map(n=>`"${n}"`).join("|"):"never"}>;`));})),await r.writeFile(j__namespace.default.join(o,"index.ts"),await c(`
189
+ export const ${t.apiName} = ${JSON.stringify(_(t),null,2)} satisfies ActionDefinition<"${t.apiName}", ${a.size>0?[...a].map(n=>`"${n}"`).join("|"):"never"}>;`));})),await r.writeFile(j__namespace.default.join(o,"index.ts"),await c(`
190
190
  ${e.actionTypes.map(t=>`export * from "./${t.apiName}";`).join(`
191
191
  `)}
192
192
  `));}function de(e){let r=Object.values(e.parameters).flatMap(({dataType:t})=>{let a=U(t);return a?[a]:[]});return [...e.operations.flatMap(t=>{switch(t.type){case"createObject":return [t.objectTypeApiName];case"modifyObject":return [t.objectTypeApiName];case"deleteObject":case"createLink":case"deleteLink":return []}}),...r]}function U(e){switch(e.type){case"objectSet":case"object":return e.objectTypeApiName;case"array":return U(e.subType);case"string":case"boolean":case"attachment":case"date":case"double":case"integer":case"long":case"timestamp":return}}function G(e){switch(e.dataType.type){case"integer":case"double":case"string":case"boolean":case"attachment":case"byte":case"decimal":case"float":case"geopoint":case"geoshape":case"long":case"short":return e.dataType.type;case"date":return "datetime";case"timestamp":return "timestamp";case"timeseries":case"array":throw new Error(`Type not supported for primaryKey: ${e.dataType.type}`);default:e.dataType;throw new Error(`Unknown type encountered for primaryKey: ${e.dataType}`)}}function z(e){switch(e.dataType.type){case"integer":case"string":case"byte":case"decimal":case"double":case"float":case"long":case"short":case"boolean":case"date":case"attachment":case"geopoint":case"geoshape":case"timestamp":case"timeseries":return {multiplicity:!1,description:e.description,type:k(e.dataType),nullable:!0};case"array":return {multiplicity:!0,description:e.description,type:k(e.dataType),nullable:!0};default:e.dataType;throw new Error(`Unexpected data type ${JSON.stringify(e.dataType)}`)}}function k(e){switch(e.type){case"integer":case"string":case"byte":case"decimal":case"double":case"float":case"long":case"short":case"boolean":case"attachment":case"geopoint":case"geoshape":case"timestamp":return e.type;case"date":return "datetime";case"array":return k(e.subType);case"timeseries":return e.itemType.type==="string"?"stringTimeseries":"numericTimeseries";default:throw new Error(`Unexecpected data type ${e}`)}}function O(e,r=[]){return {apiName:e.apiName,description:e.description,primaryKeyType:G(e.properties[e.primaryKey]),links:Object.fromEntries(r.map(o=>[o.apiName,{multiplicity:o.cardinality==="MANY",targetType:o.objectTypeApiName}])),properties:Object.fromEntries(Object.entries(e.properties).map(([o,t])=>[o,z(t)]))}}var ge=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","implements","interface","let","package","private","protected","public","static","yield"]);function B(e){return ge.has(e)}function W(e,r=[]){let o=new Set(r.map(t=>t.objectTypeApiName).filter(t=>t!==e.apiName));return `import type { OntologyObject, LocalDate, Timestamp, GeoShape, GeoPoint, Attachment, TimeSeries, MultiLink, SingleLink } from "@osdk/legacy-client";
@@ -233,7 +233,7 @@ ${r.flatMap(t=>[`readonly ${t.apiName}: ${t.cardinality==="MANY"?"MultiLink":"Si
233
233
  ${a.join(`
234
234
  `)}
235
235
  }
236
- `));}function g(e,r){switch(e.type){case"boolean":return "boolean";case"string":return "string";case"double":case"float":case"integer":case"long":return "number";case"date":return "LocalDate";case"timestamp":return "Timestamp";case"attachment":return "Attachment";case"array":return `Array<${g(e.subType,r)}>`;case"object":{let a=e.objectTypeApiName;return r.add(a),a}case"objectSet":{let a=e.objectTypeApiName;return r.add(a),`ObjectSet<${a}>`}case"set":return `Set<${g(e.subType,r)}>`;case"struct":return `{ ${e.fields.map(a=>{let n=d(a.fieldType);return `${a.name}${n?"?":""}: ${g(a.fieldType,r)}`}).join(`,
236
+ `));}function g(e,r){switch(e.type){case"boolean":return "boolean";case"string":return "string";case"double":case"float":case"integer":case"long":return "number";case"date":return "LocalDate";case"timestamp":return "Timestamp";case"attachment":return "Attachment";case"array":return `Array<${g(e.subType,r)}>`;case"object":{let a=e.objectTypeApiName;return r.add(a),`${a} | ${a}["__primaryKey"]`}case"objectSet":{let a=e.objectTypeApiName;return r.add(a),`ObjectSet<${a}>`}case"set":return `Set<${g(e.subType,r)}>`;case"struct":return `{ ${e.fields.map(a=>{let n=d(a.fieldType);return `${a.name}${n?"?":""}: ${g(a.fieldType,r)}`}).join(`,
237
237
  `)} }`;case"union":return e.unionTypes.map(a=>g(a,r)).filter(a=>a!=="null").join("|");case"twoDimensionalAggregation":return e.valueType,`TwoDimensionalAggregation<
238
238
  ${x(e.keyType)},
239
239
  ${re(e.valueType)}
@@ -241,7 +241,7 @@ ${r.flatMap(t=>[`readonly ${t.apiName}: ${t.cardinality==="MANY"?"MultiLink":"Si
241
241
  ${x(e.keyType)},
242
242
  ${x(e.valueType.keyType)},
243
243
  ${re(e.valueType.valueType)}
244
- >`;case"null":return "null";case"unsupported":throw new Error("Cannot generate queries for unsupported type");default:throw new Error(`Cannot generate queries for type ${e.type}`)}}function x(e){switch(e.type){case"boolean":return "boolean";case"double":case"integer":return "number";case"string":return "string";case"date":return "LocalDate";case"timestamp":return "Timestamp";case"range":return `Range<${$e(e.subType)}>`;default:throw new Error(`Unknown TwoDimensionalAggregation keyType ${e.type}`)}}function $e(e){switch(e.type){case"date":return "LocalDate";case"double":case"integer":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported QueryAggregationRangeSubType ${e.type}`)}}function re(e){switch(e.type){case"date":return "LocalDate";case"double":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported QueryAggregationValueType ${e.type}`)}}function oe(e){return e.replace(/\s/g,"")}async function he(e,r,o){let t=j__namespace.join(o,"ontology","objects"),a=j__namespace.join(o,"ontology","actions"),n=j__namespace.join(o,"ontology","queries"),s=F(e);await v(r,o),await I(s,r,o),await M(r,j__namespace.join(o,"ontology")),await L(s,r,t),await Z(s,r,t),await Q(s,r,a),await K(s,r,a),await ae(s,r,n),await te(s,r,n),await C(r,o);}function ne(e){return `
244
+ >`;case"null":return "null";case"unsupported":throw new Error("Cannot generate queries for unsupported type");default:throw new Error(`Cannot generate queries for type ${e.type}`)}}function x(e){switch(e.type){case"boolean":return "boolean";case"double":case"integer":return "number";case"string":return "string";case"date":return "LocalDate";case"timestamp":return "Timestamp";case"range":return `Range<${we(e.subType)}>`;default:throw new Error(`Unknown TwoDimensionalAggregation keyType ${e.type}`)}}function we(e){switch(e.type){case"date":return "LocalDate";case"double":case"integer":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported QueryAggregationRangeSubType ${e.type}`)}}function re(e){switch(e.type){case"date":return "LocalDate";case"double":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported QueryAggregationValueType ${e.type}`)}}function oe(e){return e.replace(/\s/g,"")}async function he(e,r,o){let t=j__namespace.join(o,"ontology","objects"),a=j__namespace.join(o,"ontology","actions"),n=j__namespace.join(o,"ontology","queries"),s=F(e);await v(r,o),await I(s,r,o),await M(r,j__namespace.join(o,"ontology")),await L(s,r,t),await Z(s,r,t),await Q(s,r,a),await K(s,r,a),await ae(s,r,n),await te(s,r,n),await C(r,o);}function ne(e){return `
245
245
  export interface ${e.apiName} extends ObjectDefinition<"${e.apiName}", "${e.apiName}">{
246
246
  apiName: "${e.apiName}";
247
247
  properties: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/v1.1/generateClientSdkVersionOneDotOne.ts","../../src/shared/sanitizeMetadata.ts","../../src/v1.1/generateActions.ts","../../src/shared/getEditedEntities.ts","../../src/util/test/formatTs.ts","../../src/v1.1/generateFoundryClientFile.ts","../../src/v1.1/generateIndexFile.ts","../../src/v1.1/generateMetadataFile.ts","../../src/util/commaSeparatedIdentifiers.ts","../../src/util/commaSeparatedTypeIdentifiers.ts","../../src/v1.1/generateObjectsInterfaceFile.ts","../../src/v1.1/generateOntologyIndexFile.ts","../../src/v1.1/generatePerActionDataFiles.ts","../../src/shared/wireActionTypeV2ToSdkActionDefinition.ts","../../src/v1.1/generatePerObjectInterfaceAndDataFiles.ts","../../src/shared/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/shared/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/shared/wireObjectTypeV2ToSdkObjectDefinition.ts","../../src/util/reservedKeywords.ts","../../src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts","../../src/v1.1/generatePerQueryDataFiles.ts","../../src/shared/isNullableQueryDataType.ts","../../src/shared/wireQueryDataTypeToQueryDataTypeDefinition.ts","../../src/shared/wireQueryTypeV2ToSdkQueryDefinition.ts","../../src/v1.1/generateQueries.ts","../../src/v2.0/generateClientSdkVersionTwoPointZero.ts","../../src/v2.0/wireObjectTypeV2ToObjectDefinitionInterfaceString.ts"],"names":["path","sanitizeMetadata","ontology","actionType","camelize","name","segment","getModifiedEntityTypes","action","addedObjects","modifiedObjects","operation","_","format","organizeImports","formatTs","contents","generateActions","fs","outDir","importedObjects","actionSignatures","entries","modifiedEntityTypes","jsDocBlock","parameterBlock","parameterName","parameterData","typeScriptType","getTypeScriptTypeFromDataType","importedObject","actionParameter","objectType","generateFoundryClientFile","generateIndexFile","commaSeparatedIdentifiers","identifiers","alternateNames","i","alt","commaSeparatedTypeIdentifiers","altNames","generateMetadataFile","objectNames","actionNames","queryNames","query","actionAltNames","queryAltNames","seenIdentifiers","actionName","queryName","getImportClause","n","queryType","generateObjectsInterfaceFile","apiName","generateOntologyIndexFile","wireActionTypeV2ToSdkActionDefinition","input","key","value","wireActionParameterV2ToSdkParameterDefinition","createModifiedEntities","actionPropertyToSdkPropertyDefinition","parameterType","entities","generatePerActionDataFiles","uniqueApiNames","extractReferencedObjectsFromAction","referencedObjectsInParameters","dataType","objectTypeReference","extractReferencedObjectsFromActionParameter","wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","objectPropertyTypeToSdkPropertyDefinition","propertyType","wireObjectTypeV2ToSdkObjectDefinition","linkTypes","linkType","reservedKeywords","isReservedKeyword","wireObjectTypeV2ToObjectInterfaceStringV1","uniqueLinkTargets","a","linkTarget","getDescriptionIfPresent","wirePropertyTypeV2ToTypeScriptType","propertyName","propertyDefinition","property","description","generatePerObjectInterfaceAndDataFiles","object","links","isNullableQueryDataType","t","wireQueryDataTypeToQueryDataTypeDefinition","allowNulls","nonnull","acc","f","get2DQueryAggregationProps","get3DQueryAggregationProps","guardInvalidKeyTypes","wireQueryTypeV2ToSdkQueryDefinition","parameter","wireQueryParameterV2ToQueryParameterDefinition","generatePerQueryDataFiles","objectTypes","getObjectTypesFromQuery","types","getObjectTypesFromDataType","prop","type","generateQueries","signatures","outputType","handleQueryDataType","paramEntries","nullable","sanitizeDocTypeName","param","field","isNullable","aggregationKeyToTypescriptType","aggregationValueToTypescriptType","keyType","aggregationRangeToTypescriptType","subType","valueType","generateClientSdkVersionOneDotOne","objectsDir","actionsDir","queriesDir","sanitizedOntology","wireObjectTypeV2ToObjectDefinitionInterfaceString","generateClientSdkVersionTwoPointZero","obj"],"mappings":"AAgBA,UAAYA,MAAU,OCAf,SAASC,EAAiBC,EAAU,CACzC,MAAO,CACL,GAAGA,EACH,YAAaA,EAAS,YAAY,IAAIC,IAC7B,CACL,GAAGA,EACH,QAASC,GAASD,EAAW,OAAO,CACtC,EACD,CACH,CACF,CACA,SAASC,GAASC,EAAM,CACtB,OAAOA,EAAK,QAAQ,MAAOC,GAAWA,EAAQ,CAAC,EAAE,YAAY,CAAC,CAChE,CCbA,OAAON,OAAU,OCAV,SAASO,EAAuBC,EAAQ,CAC7C,IAAMC,EAAe,IAAI,IACnBC,EAAkB,IAAI,IAC5B,QAAWC,KAAaH,EAAO,WAC7B,OAAQG,EAAU,KAAM,CACtB,IAAK,eACHF,EAAa,IAAIE,EAAU,iBAAiB,EAC5C,MACF,IAAK,eACHD,EAAgB,IAAIC,EAAU,iBAAiB,EAC/C,MACF,IAAK,eACL,IAAK,aACL,IAAK,aACH,MACF,QACE,IAAMC,EAAID,CACd,CAEF,MAAO,CACL,aAAAF,EACA,gBAAAC,CACF,CACF,CCvBA,OAAS,UAAAG,OAAc,WAGvB,OAAOC,OAAqB,mCACrB,SAASC,EAASC,EAAU,CACjC,OAAOH,GAAOG,EAAU,CACtB,OAAQ,aACR,YAAa,GACb,cAAe,MACf,QAAS,CAACF,EAAe,EACzB,SAAU,EACV,WAAY,GACd,CAAC,CACH,CFVA,eAAsBG,EAAgBf,EAAUgB,EAAIC,EAAQ,CAC1D,IAAMC,EAAkB,IAAI,IACxBC,EAAmB,CAAC,EACxB,QAAWb,KAAUN,EAAS,YAAa,CACzC,IAAMoB,EAAU,OAAO,QAAQd,EAAO,UAAU,EAC1Ce,EAAsBhB,EAAuBC,CAAM,EACnDC,EAAe,MAAM,KAAKc,EAAoB,YAAY,EAC1Db,EAAkB,MAAM,KAAKa,EAAoB,eAAe,EACtEd,EAAa,QAAQW,EAAg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AM;AAAA;AAAA,WAEtDA,EAAM,aAAe,EAAE;AAAA;AAAA,QAE1BD,CAAG;AAAA,mBACQC,EAAM,SAAS,IAAI;AAAA,0BACZA,EAAM,aAAeD,CAAG;AAAA;AAAA;AAAA,SAGzC,CAAC;AAAA;AAAA;AAAA,GAIV,CDdA,eAAsB8E,GAAqCxI,EAAUgB,EAAIC,EAAQ,CAC/ED,EAAG,UAAUlB,EAAK,KAAKmB,EAAQ,UAAU,EAAG,MAAMJ,EAAS;AAAA;AAAA,KAExD,CAAC,EACJ,IAAM4B,EAAc,OAAO,KAAKzC,EAAS,WAAW,EACpDgB,EAAG,UAAUlB,EAAK,KAAKmB,EAAQ,aAAa,EAAG,MAAMJ,EAAS;AAAA;AAAA,QAExD4B,EAAY,IAAItC,GAAQ,WAAWA,CAAI,qBAAqBA,CAAI,IAAI,EAAE,KAAK;AAAA,CAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAO5EsC,EAAY,IAAItC,GAAQ,GAAGA,CAAI,KAAKA,CAAI,GAAG,EAAE,KAAK;AAAA,CAAI,CAAC;AAAA;AAAA,uCAE5BsC,EAAY,IAAIU,GAAK,IAAIA,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC;AAAA,KAC1E,CAAC,EACJ,QAAWhD,KAAQsC,EAAa,CAC9B,IAAMgG,EAAMzI,EAAS,YAAYG,CAAI,EACrCa,EAAG,UAAUlB,EAAK,KAAKmB,EAAQ,UAAW,GAAGd,CAAI,KAAK,EAAG,MAAMU,EAAS;AAAA;AAAA;AAAA;AAAA,qBAIvDV,CAAI,OAAO,KAAK,UAAUyE,EAAsC6D,CAAG,EAAG,KAAM,CAAC,CAAC,cAActI,CAAI;AAAA;AAAA,QAE7GoI,GAAkDE,CAAG,CAAC;AAAA,KACzD,CAAC,CACJ,CACF","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 */\n\nimport * as path from \"node:path\";\nimport { sanitizeMetadata } from \"../shared/sanitizeMetadata\";\nimport { generateActions } from \"./generateActions\";\nimport { generateFoundryClientFile } from \"./generateFoundryClientFile\";\nimport { generateIndexFile } from \"./generateIndexFile\";\nimport { generateMetadataFile } from \"./generateMetadataFile\";\nimport { generateObjectsInterfaceFile } from \"./generateObjectsInterfaceFile\";\nimport { generateOntologyIndexFile } from \"./generateOntologyIndexFile\";\nimport { generatePerActionDataFiles } from \"./generatePerActionDataFiles\";\nimport { generatePerObjectInterfaceAndDataFiles } from \"./generatePerObjectInterfaceAndDataFiles\";\nimport { generatePerQueryDataFiles } from \"./generatePerQueryDataFiles\";\nimport { generateQueries } from \"./generateQueries\";\nexport async function generateClientSdkVersionOneDotOne(ontology, fs, outDir) {\n const objectsDir = path.join(outDir, \"ontology\", \"objects\");\n const actionsDir = path.join(outDir, \"ontology\", \"actions\");\n const queriesDir = path.join(outDir, \"ontology\", \"queries\");\n const sanitizedOntology = sanitizeMetadata(ontology);\n await generateFoundryClientFile(fs, outDir);\n await generateMetadataFile(sanitizedOntology, fs, outDir);\n await generateOntologyIndexFile(fs, path.join(outDir, \"ontology\"));\n await generateObjectsInterfaceFile(sanitizedOntology, fs, objectsDir);\n await generatePerObjectInterfaceAndDataFiles(sanitizedOntology, fs, objectsDir);\n await generateActions(sanitizedOntology, fs, actionsDir);\n await generatePerActionDataFiles(sanitizedOntology, fs, actionsDir);\n await generateQueries(sanitizedOntology, fs, queriesDir);\n await generatePerQueryDataFiles(sanitizedOntology, fs, queriesDir);\n await generateIndexFile(fs, outDir);\n}","/*\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 */\n\nexport function sanitizeMetadata(ontology) {\n return {\n ...ontology,\n actionTypes: ontology.actionTypes.map(actionType => {\n return {\n ...actionType,\n apiName: camelize(actionType.apiName)\n };\n })\n };\n}\nfunction camelize(name) {\n return name.replace(/-./g, segment => segment[1].toUpperCase());\n}","/*\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 */\n\nimport path from \"path\";\nimport { getModifiedEntityTypes } from \"../shared/getEditedEntities\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateActions(ontology, fs, outDir) {\n const importedObjects = new Set();\n let actionSignatures = [];\n for (const action of ontology.actionTypes) {\n const entries = Object.entries(action.parameters);\n const modifiedEntityTypes = getModifiedEntityTypes(action);\n const addedObjects = Array.from(modifiedEntityTypes.addedObjects);\n const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);\n addedObjects.forEach(importedObjects.add, importedObjects);\n modifiedObjects.forEach(importedObjects.add, importedObjects);\n let jsDocBlock = [\"/**\"];\n if (action.description) {\n jsDocBlock.push(`* ${action.description}`);\n }\n let parameterBlock = \"\";\n if (entries.length > 0) {\n parameterBlock = `params: { \\n`;\n for (const [parameterName, parameterData] of entries) {\n parameterBlock += `\"${parameterName}\"`;\n parameterBlock += parameterData.required ? \": \" : \"?: \";\n const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);\n parameterBlock += `${typeScriptType};\\n`;\n jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);\n }\n parameterBlock += \"}, \";\n }\n jsDocBlock.push(`*/`);\n actionSignatures.push(`\n ${jsDocBlock.join(\"\\n\")}\n ${action.apiName}<O extends ActionExecutionOptions>(${parameterBlock}options?: O): \n Promise<Result<ActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(\" | \") : \"void\"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(\" | \") : \"void\"}>>, ActionError>>;`);\n }\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Actions.ts\"), await formatTs(`\n import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, ActionError, Result, ActionResponseFromOptions } from \"@osdk/legacy-client\";\n ${Array.from(importedObjects).map(importedObject => `import type { ${importedObject} } from \"../objects/${importedObject}\";`).join(\"\\n\")}\n export interface Actions {\n ${actionSignatures.join(\"\\n\")}\n }\n `));\n}\nfunction getTypeScriptTypeFromDataType(actionParameter, importedObjects) {\n switch (actionParameter.type) {\n case \"objectSet\":\n {\n const objectType = actionParameter.objectTypeApiName;\n importedObjects.add(objectType);\n return `ObjectSet<${objectType}>`;\n }\n case \"object\":\n {\n const objectType = actionParameter.objectTypeApiName;\n importedObjects.add(objectType);\n return `${objectType}`;\n }\n case \"array\":\n return `Array<${getTypeScriptTypeFromDataType(actionParameter.subType, importedObjects)}>`;\n case \"string\":\n return `string`;\n case \"boolean\":\n return `boolean`;\n case \"attachment\":\n return `Attachment`;\n case \"date\":\n return `LocalDate`;\n case \"double\":\n case \"integer\":\n case \"long\":\n return `number`;\n case \"timestamp\":\n return `Timestamp`;\n default:\n const _ = actionParameter;\n throw new Error(`Unsupported action parameter type: ${actionParameter}`);\n }\n}","/*\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 */\n\nexport function getModifiedEntityTypes(action) {\n const addedObjects = new Set();\n const modifiedObjects = new Set();\n for (const operation of action.operations) {\n switch (operation.type) {\n case \"createObject\":\n addedObjects.add(operation.objectTypeApiName);\n break;\n case \"modifyObject\":\n modifiedObjects.add(operation.objectTypeApiName);\n break;\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n break;\n default:\n const _ = operation;\n }\n }\n return {\n addedObjects,\n modifiedObjects\n };\n}","/*\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 */\n\nimport { format } from \"prettier\";\n// @ts-ignore the plugin doesn't have types but we need to import the actual plugin\n// so we can bundle it rather than trying to resolve it at runtime\nimport organizeImports from \"prettier-plugin-organize-imports\";\nexport function formatTs(contents) {\n return format(contents, {\n parser: \"typescript\",\n singleQuote: true,\n trailingComma: \"all\",\n plugins: [organizeImports],\n tabWidth: 2,\n printWidth: 120\n });\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateFoundryClientFile(fs, outDir) {\n await fs.writeFile(path.join(outDir, \"FoundryClient.ts\"), await formatTs(`\n import { BaseFoundryClient } from \"@osdk/legacy-client\";\n import type { Auth, FoundryClientOptions } from \"@osdk/legacy-client\";\n import { Ontology } from \"./Ontology\";\n\n export class FoundryClient<TAuth extends Auth = Auth> extends BaseFoundryClient<typeof Ontology, TAuth> {\n constructor(options: FoundryClientOptions<TAuth>) {\n super(options, Ontology);\n }\n\n get ontology(): Ontology {\n return super.ontology;\n }\n }`));\n}","/*\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 */\n\nimport * as path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateIndexFile(fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export {\n ActionExecutionMode,\n ActionResponse,\n ActionValidationResult, \n ArrayType,\n AttachmentType,\n BooleanType,\n ByteType,\n DateType,\n DecimalType,\n DoubleType,\n FloatType,\n FoundryApiError,\n GeoPoint,\n GeoPointType,\n GeoShape,\n GeoShapeType,\n IntegerType,\n isErr,\n isOk, \n LocalDate,\n LongType,\n ObjectType,\n Op,\n Polygon,\n ReturnEditsMode,\n SetType,\n ShortType,\n StringType,\n StructField,\n StructType,\n TimeSeriesType,\n Timestamp,\n TimestampType,\n visitError,\n PublicClientAuth,\n ConfidentialClientAuth,\n UserTokenAuth\n } from '@osdk/legacy-client';\n export type {\n ActionError,\n AggregateObjectsError,\n AggregationGroup,\n AggregationResult, \n Attachment,\n AttachmentMetadata, \n AttachmentsError,\n Edits,\n ErrorVisitor,\n GetLinkedObjectError,\n GetObjectError,\n ListLinkedObjectsError,\n ListObjectsError,\n LoadObjectSetError,\n Page,\n PermissionDenied,\n QueryError,\n QueryResponse, \n Result,\n SearchObjectsError,\n TimeSeries,\n TimeSeriesError,\n TimeSeriesPoint, \n Unauthorized,\n UnknownError, \n } from '@osdk/legacy-client';\n export { Ontology } from \"./Ontology\";\n export { FoundryClient } from \"./FoundryClient\";\n `));\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { commaSeparatedIdentifiers } from \"../util/commaSeparatedIdentifiers\";\nimport { commaSeparatedTypeIdentifiers } from \"../util/commaSeparatedTypeIdentifiers\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateMetadataFile(ontology, fs, outDir) {\n const objectNames = Object.keys(ontology.objectTypes);\n const actionNames = ontology.actionTypes.map(action => action.apiName);\n const queryNames = ontology.queryTypes.map(query => query.apiName);\n const actionAltNames = new Map();\n const queryAltNames = new Map();\n const seenIdentifiers = new Set(objectNames);\n for (const actionName of actionNames) {\n if (seenIdentifiers.has(actionName)) {\n actionAltNames.set(actionName, `${actionName}Action`);\n } else {\n seenIdentifiers.add(actionName);\n }\n }\n for (const queryName of queryNames) {\n if (seenIdentifiers.has(queryName)) {\n queryAltNames.set(queryName, `${queryName}Query`);\n }\n }\n const getImportClause = (name, altNames) => {\n const alt = altNames.get(name);\n if (alt) {\n return `${name} as ${alt}`;\n } else {\n return name;\n }\n };\n await fs.writeFile(path.join(outDir, \"Ontology.ts\"), await formatTs(`\n import type { OntologyDefinition } from \"@osdk/api\";\n import type { Ontology as ClientOntology } from \"@osdk/legacy-client\";\n import type { Objects } from \"./ontology/objects/Objects\";\n import type { Actions } from \"./ontology/actions/Actions\";\n import type { Queries } from \"./ontology/queries/Queries\";\n ${objectNames.map(name => `import {${name}} from \"./ontology/objects/${name}\";`).join(\"\\n\")}\n ${actionNames.map(name => `import {${getImportClause(name, actionAltNames)}} from \"./ontology/actions/${name}\";`).join(\"\\n\")}\n ${queryNames.map(name => `import {${getImportClause(name, queryAltNames)}} from \"./ontology/queries/${name}\";`).join(\"\\n\")}\n\n export const Ontology : {\n metadata: {\n ontologyRid: \"${ontology.rid}\",\n ontologyApiName: \"${ontology.apiName}\",\n userAgent: \"foundry-typescript-osdk/0.0.1\",\n },\n objects: {\n ${commaSeparatedTypeIdentifiers(objectNames)}\n },\n actions: {\n ${commaSeparatedTypeIdentifiers(actionNames, actionAltNames)}\n },\n queries: {\n ${commaSeparatedTypeIdentifiers(queryNames, queryAltNames)}\n },\n } = {\n metadata: {\n ontologyRid: \"${ontology.rid}\" as const,\n ontologyApiName: \"${ontology.apiName}\" as const,\n userAgent: \"foundry-typescript-osdk/0.0.1\" as const,\n },\n objects: {\n ${commaSeparatedIdentifiers(objectNames)}\n },\n actions: {\n ${commaSeparatedIdentifiers(actionNames, actionAltNames)}\n },\n queries: {\n ${commaSeparatedIdentifiers(queryNames, queryAltNames)}\n }\n } satisfies OntologyDefinition<${objectNames.map(n => `\"${n}\"`).join(\"|\")}, ${ontology.actionTypes.map(actionType => `\"${actionType.apiName}\"`).join(\"|\")}, ${ontology.queryTypes.map(queryType => `\"${queryType.apiName}\"`).join(\"|\")}>;\n \nexport interface Ontology extends ClientOntology<typeof Ontology> {\n objects: Objects;\n actions: Actions;\n queries: Queries;\n}`));\n}","/*\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 */\n\nexport function commaSeparatedIdentifiers(identifiers, alternateNames) {\n return identifiers.map(i => {\n const alt = alternateNames?.get(i);\n if (alt) {\n return `${i}: ${alt}`;\n }\n return i;\n }).join(\",\");\n}","/*\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 */\n\nexport function commaSeparatedTypeIdentifiers(identifiers, altNames) {\n return identifiers.map(i => `${i}: typeof ${altNames?.get(i) ?? i}`).join(\",\");\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateObjectsInterfaceFile(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Objects.ts\"), await formatTs(`\n import { BaseObjectSet } from \"@osdk/legacy-client\";\n ${Array.from(Object.keys(ontology.objectTypes)).map(importedObject => `import type { ${importedObject} } from \"./${importedObject}\";`).join(\"\\n\")}\n \n export interface Objects {\n ${Object.keys(ontology.objectTypes).map(apiName => `${apiName} : BaseObjectSet<${apiName}>;`).join(\"\\n\")}\n }\n ;`));\n}","/*\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 */\n\nimport * as path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateOntologyIndexFile(fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export type { ObjectSet } from \"@osdk/legacy-client\";\n `));\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireActionTypeV2ToSdkActionDefinition } from \"../shared/wireActionTypeV2ToSdkActionDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generatePerActionDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(ontology.actionTypes.map(async action => {\n const uniqueApiNames = new Set(extractReferencedObjectsFromAction(action));\n await fs.writeFile(path.join(outDir, `${action.apiName}.ts`), await formatTs(`\n import { ActionDefinition } from \"@osdk/api\";\n \n export const ${action.apiName} = ${JSON.stringify(wireActionTypeV2ToSdkActionDefinition(action), null, 2)} satisfies ActionDefinition<\"${action.apiName}\", ${uniqueApiNames.size > 0 ? [...uniqueApiNames].map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, `index.ts`), await formatTs(`\n ${ontology.actionTypes.map(action => `export * from \"./${action.apiName}\";`).join(\"\\n\")}\n `));\n}\nfunction extractReferencedObjectsFromAction(actionType) {\n const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({\n dataType\n }) => {\n const objectTypeReference = extractReferencedObjectsFromActionParameter(dataType);\n return objectTypeReference ? [objectTypeReference] : [];\n });\n const referenceObjectsInEdits = actionType.operations.flatMap(value => {\n switch (value.type) {\n case \"createObject\":\n return [value.objectTypeApiName];\n case \"modifyObject\":\n return [value.objectTypeApiName];\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n return [];\n }\n });\n return [...referenceObjectsInEdits, ...referencedObjectsInParameters];\n}\nfunction extractReferencedObjectsFromActionParameter(actionParameter) {\n switch (actionParameter.type) {\n case \"objectSet\":\n case \"object\":\n return actionParameter.objectTypeApiName;\n case \"array\":\n return extractReferencedObjectsFromActionParameter(actionParameter.subType);\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"date\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"timestamp\":\n return undefined;\n }\n}","/*\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 */\n\nimport { getModifiedEntityTypes } from \"./getEditedEntities\";\nexport function wireActionTypeV2ToSdkActionDefinition(input) {\n const modifiedEntityTypes = getModifiedEntityTypes(input);\n return {\n apiName: input.apiName,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([key, value]) => [key, wireActionParameterV2ToSdkParameterDefinition(value)])),\n displayName: input.displayName,\n description: input.description,\n modifiedEntities: createModifiedEntities(modifiedEntityTypes.addedObjects, modifiedEntityTypes.modifiedObjects)\n };\n}\nfunction wireActionParameterV2ToSdkParameterDefinition(value) {\n switch (value.dataType.type) {\n case \"string\":\n case \"boolean\":\n case \"object\":\n case \"attachment\":\n case \"date\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"objectSet\":\n case \"timestamp\":\n return {\n multiplicity: false,\n type: actionPropertyToSdkPropertyDefinition(value.dataType),\n nullable: value.required ? false : true,\n description: value.description\n };\n case \"array\":\n return {\n multiplicity: true,\n type: actionPropertyToSdkPropertyDefinition(value.dataType),\n nullable: value.required ? false : true,\n description: value.description\n };\n }\n}\nfunction actionPropertyToSdkPropertyDefinition(parameterType) {\n switch (parameterType.type) {\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"timestamp\":\n return parameterType.type;\n case \"date\":\n return \"datetime\";\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: parameterType.objectTypeApiName\n };\n case \"object\":\n return {\n type: \"object\",\n object: parameterType.objectTypeApiName\n };\n case \"array\":\n return actionPropertyToSdkPropertyDefinition(parameterType.subType);\n }\n}\nfunction createModifiedEntities(addedObjects, modifiedObjects) {\n let entities = {};\n for (const key of addedObjects) {\n entities[key] = {\n created: true,\n modified: false\n };\n }\n for (const key of modifiedObjects) {\n if (entities[key]) {\n entities[key].modified = true;\n } else {\n entities[key] = {\n created: false,\n modified: true\n };\n }\n }\n return entities;\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireObjectTypeV2ToSdkObjectDefinition } from \"../shared/wireObjectTypeV2ToSdkObjectDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nimport { wireObjectTypeV2ToObjectInterfaceStringV1 } from \"./wireObjectTypeV2ToV1ObjectInterfaceString\";\nexport async function generatePerObjectInterfaceAndDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(Object.values(ontology.objectTypes).map(async object => {\n const links = ontology.linkTypes[object.apiName];\n const uniqueApiNames = new Set(links?.map(a => a.objectTypeApiName));\n await fs.writeFile(path.join(outDir, `${object.apiName}.ts`), await formatTs(`\n import { ObjectDefinition } from \"@osdk/api\";\n ${wireObjectTypeV2ToObjectInterfaceStringV1(object, links)}\n\n export const ${object.apiName} = ${JSON.stringify(wireObjectTypeV2ToSdkObjectDefinition(object, links), null, 2)} satisfies ObjectDefinition<\"${object.apiName}\", ${uniqueApiNames.size > 0 ? [...uniqueApiNames].map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n ${Object.keys(ontology.objectTypes).map(apiName => `export * from \"./${apiName}\";`).join(\"\\n\")}\n export type { ObjectSet } from \"@osdk/legacy-client\";\\n\n `));\n}","/*\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 */\n\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"byte\":\n case \"decimal\":\n case \"float\":\n case \"geopoint\":\n case \"geoshape\":\n case \"long\":\n case \"short\":\n {\n return input.dataType.type;\n }\n case \"date\":\n {\n return \"datetime\";\n }\n case \"timestamp\":\n {\n return \"timestamp\";\n }\n case \"timeseries\":\n case \"array\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}","/*\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 */\n\nexport function wirePropertyV2ToSdkPropertyDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"date\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n return {\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n case \"array\":\n {\n return {\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n }\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\n switch (propertyType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n return propertyType.type;\n case \"date\":\n return \"datetime\";\n case \"array\":\n return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);\n case \"timeseries\":\n if (propertyType.itemType.type === \"string\") {\n return \"stringTimeseries\";\n }\n return \"numericTimeseries\";\n default:\n const _ = propertyType;\n throw new Error(`Unexecpected data type ${propertyType}`);\n }\n}","/*\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 */\n\nimport { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition\";\nexport function wireObjectTypeV2ToSdkObjectDefinition(input, linkTypes = []) {\n return {\n apiName: input.apiName,\n description: input.description,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input.properties[input.primaryKey]),\n links: Object.fromEntries(linkTypes.map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName\n }];\n })),\n properties: Object.fromEntries(Object.entries(input.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value)]))\n };\n}","/*\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 */\n\n// This must match the reservedKeywords definition in packages/legacy-client\nconst reservedKeywords = new Set([\"break\", \"case\", \"catch\", \"class\", \"const\", \"continue\", \"debugger\", \"default\", \"delete\", \"do\", \"else\", \"enum\", \"export\", \"extends\", \"false\", \"finally\", \"for\", \"function\", \"if\", \"import\", \"in\", \"instanceof\", \"new\", \"null\", \"return\", \"super\", \"switch\", \"this\", \"throw\", \"true\", \"try\", \"typeof\", \"var\", \"void\", \"while\", \"with\", \"implements\", \"interface\", \"let\", \"package\", \"private\", \"protected\", \"public\", \"static\", \"yield\"]);\nexport function isReservedKeyword(name) {\n return reservedKeywords.has(name);\n}","/*\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 */\n\nimport { isReservedKeyword } from \"../util/reservedKeywords\";\nexport function wireObjectTypeV2ToObjectInterfaceStringV1(input, linkTypes = []) {\n const uniqueLinkTargets = new Set(linkTypes.map(a => a.objectTypeApiName).filter(a => a !== input.apiName));\n return `import type { OntologyObject, LocalDate, Timestamp, GeoShape, GeoPoint, Attachment, TimeSeries, MultiLink, SingleLink } from \"@osdk/legacy-client\";\n${Array.from(uniqueLinkTargets).map(linkTarget => `import type { ${linkTarget} } from \"./${linkTarget}\";`).join(\"\\n\")}\n\n ${getDescriptionIfPresent(input.description)}export interface ${input.apiName} extends OntologyObject {\n readonly __apiName: \"${input.apiName}\";\n readonly __primaryKey: ${wirePropertyTypeV2ToTypeScriptType(input.properties[input.primaryKey].dataType)};\n${Object.entries(input.properties).flatMap(([propertyName, propertyDefinition]) => {\n const propertyType = wirePropertyTypeV2ToTypeScriptType(propertyDefinition.dataType);\n const entries = [`${getDescriptionIfPresent(propertyDefinition.description)}readonly ${propertyName}: ${propertyType} | undefined`];\n if (isReservedKeyword(propertyName)) {\n entries.push(`/** @deprecated please migrate to '${propertyName}' instead */\n readonly ${propertyName}_: ${propertyType} | undefined`);\n }\n return entries;\n }).join(\";\\n\")}\n${linkTypes.flatMap(linkType => {\n const entries = [`readonly ${linkType.apiName}: ${linkType.cardinality === \"MANY\" ? \"MultiLink\" : \"SingleLink\"}<${linkType.objectTypeApiName}>`];\n return entries;\n }).join(\";\\n\")}\n}\n `;\n}\nfunction wirePropertyTypeV2ToTypeScriptType(property) {\n switch (property.type) {\n case \"string\":\n return \"string\";\n case \"boolean\":\n return \"boolean\";\n case \"array\":\n return wirePropertyTypeV2ToTypeScriptType(property.subType) + \"[]\";\n case \"integer\":\n return \"number\";\n case \"attachment\":\n return \"Attachment\";\n case \"byte\":\n return \"number\";\n case \"date\":\n return \"LocalDate\";\n case \"decimal\":\n return \"number\";\n case \"double\":\n return \"number\";\n case \"float\":\n return \"number\";\n case \"geopoint\":\n return \"GeoPoint\";\n case \"geoshape\":\n return \"GeoShape\";\n case \"long\":\n return \"number\";\n case \"short\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"timeseries\":\n return property.itemType.type === \"string\" ? `TimeSeries<string>` : `TimeSeries<number>`;\n default:\n const _ = property;\n throw new Error(`Unknown property type ${property}`);\n }\n}\nfunction getDescriptionIfPresent(description) {\n if (description) {\n return `/**\n * ${description}\n */\\n`;\n }\n return \"\";\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireQueryTypeV2ToSdkQueryDefinition } from \"../shared/wireQueryTypeV2ToSdkQueryDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generatePerQueryDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(ontology.queryTypes.map(async query => {\n const objectTypes = getObjectTypesFromQuery(query);\n await fs.writeFile(path.join(outDir, `${query.apiName}.ts`), await formatTs(`\n import { QueryDefinition } from \"@osdk/api\";\n\n export const ${query.apiName} = ${JSON.stringify(wireQueryTypeV2ToSdkQueryDefinition(query))} satisfies QueryDefinition<\"${query.apiName}\", ${objectTypes.length > 0 ? objectTypes.map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n ${ontology.queryTypes.map(query => `export * from \"./${query.apiName}\";`).join(\"\\n\")}\n `));\n}\nfunction getObjectTypesFromQuery(query) {\n const types = new Set();\n for (const {\n dataType\n } of Object.values(query.parameters)) {\n getObjectTypesFromDataType(dataType, types);\n }\n getObjectTypesFromDataType(query.output, types);\n return Array.from(types);\n}\nfunction getObjectTypesFromDataType(dataType, types) {\n switch (dataType.type) {\n case \"array\":\n case \"set\":\n getObjectTypesFromDataType(dataType.subType, types);\n return;\n case \"object\":\n types.add(dataType.objectTypeApiName);\n return;\n case \"objectSet\":\n types.add(dataType.objectTypeApiName);\n return;\n case \"struct\":\n for (const prop of Object.values(dataType.fields)) {\n getObjectTypesFromDataType(prop.fieldType, types);\n }\n return;\n case \"union\":\n for (const type of dataType.unionTypes) {\n getObjectTypesFromDataType(type, types);\n }\n return;\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"null\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"unsupported\":\n /* complete no-op */\n return;\n default:\n const _ = dataType;\n throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);\n }\n}","/*\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 */\n\nexport function isNullableQueryDataType(input) {\n if (input.type === \"null\") {\n return true;\n }\n if (input.type === \"union\") {\n return input.unionTypes.some(t => isNullableQueryDataType(t));\n }\n return false;\n}","/*\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 */\n\nimport { isNullableQueryDataType } from \"./isNullableQueryDataType\";\nexport function wireQueryDataTypeToQueryDataTypeDefinition(input) {\n switch (input.type) {\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"string\":\n case \"timestamp\":\n return {\n type: input.type,\n nullable: false\n };\n case \"object\":\n return {\n type: {\n type: \"object\",\n object: input.objectTypeApiName\n },\n nullable: false\n };\n case \"objectSet\":\n return {\n type: {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName\n },\n nullable: false\n };\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true\n };\n case \"set\":\n return {\n type: {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType)\n },\n nullable: false\n };\n case \"union\":\n const allowNulls = isNullableQueryDataType(input);\n\n // special case for a union where one half is nullable to skip the union step and just allow nulls directly\n if (allowNulls && input.unionTypes.length === 2) {\n const nonnull = input.unionTypes.find(t => t.type !== null);\n if (nonnull) {\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(nonnull),\n nullable: true\n };\n }\n }\n return {\n type: {\n type: \"union\",\n union: input.unionTypes.reduce((acc, t) => {\n if (t.type === \"null\") {\n return acc;\n }\n acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));\n return acc;\n }, [])\n },\n nullable: allowNulls\n };\n case \"struct\":\n return {\n type: {\n type: \"struct\",\n struct: Object.fromEntries(input.fields.map(f => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)]))\n },\n nullable: false\n };\n case \"twoDimensionalAggregation\":\n return {\n type: {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input)\n }\n };\n case \"threeDimensionalAggregation\":\n return {\n type: {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input)\n }\n };\n case \"null\":\n case \"unsupported\":\n throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);\n default:\n const _ = input;\n throw new Error(`Unsupported QueryDataType.type ${input.type}`);\n }\n}\nfunction get2DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: input.valueType.type\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: input.valueType.type\n };\n }\n throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);\n }\n}\nfunction get3DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: get2DQueryAggregationProps(input.valueType)\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: get2DQueryAggregationProps(input.valueType)\n };\n }\n throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);\n }\n}\n\n/**\n * Guard against aggregation key types that are allowed by the backend types but are illegal to actually use\n */\nfunction guardInvalidKeyTypes(key) {\n return key.type === \"string\" || key.type === \"boolean\";\n}","/*\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 */\n\nimport { wireQueryDataTypeToQueryDataTypeDefinition } from \"./wireQueryDataTypeToQueryDataTypeDefinition\";\nexport function wireQueryTypeV2ToSdkQueryDefinition(input) {\n return {\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n rid: input.rid,\n version: input.version,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),\n output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)\n };\n}\nfunction wireQueryParameterV2ToQueryParameterDefinition(parameter) {\n return {\n description: parameter.description,\n dataType: wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)\n };\n}","/*\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 */\n\nimport path from \"path\";\nimport { isNullableQueryDataType } from \"../shared/isNullableQueryDataType\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateQueries(ontology, fs, outDir) {\n const importedObjects = new Set();\n const signatures = [];\n for (const query of ontology.queryTypes) {\n const jsDocBlock = [\"/**\"];\n if (query.description) {\n jsDocBlock.push(`* ${query.description}`);\n }\n const outputType = handleQueryDataType(query.output, importedObjects);\n const paramEntries = [];\n for (const [name, parameter] of Object.entries(query.parameters)) {\n const nullable = isNullableQueryDataType(parameter.dataType);\n const type = handleQueryDataType(parameter.dataType, importedObjects);\n paramEntries.push(`\"${name}\"${nullable ? \"?\" : \"\"}: ${type}`);\n jsDocBlock.push(`* @param {${sanitizeDocTypeName(type)}} params.${name}${parameter.description ? ` - ${parameter.description}` : \"\"}`);\n }\n const param = paramEntries.length === 0 ? \"\" : `params: { ${paramEntries.join(\"; \")} }`;\n jsDocBlock.push(`* @returns ${sanitizeDocTypeName(outputType)}`, \"*/\");\n signatures.push(`\n ${jsDocBlock.join(\"\\n\")}\n ${query.apiName}(${param}): Promise<Result<QueryResponse<${outputType}>, QueryError>>;\n `);\n }\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Queries.ts\"), await formatTs(`\n import type { QueryResponse, QueryError, Result, Timestamp, LocalDate, Range, Attachment, ObjectSet, TwoDimensionalAggregation, ThreeDimensionalAggregation } from \"@osdk/legacy-client\";\n ${Array.from(importedObjects).map(importedObject => `import type { ${importedObject} } from \"../objects/${importedObject}\";`).join(\"\\n\")}\n\n export interface Queries {\n ${signatures.join(\"\\n\")}\n }\n `));\n}\nfunction handleQueryDataType(dataType, importedObjects) {\n switch (dataType.type) {\n case \"boolean\":\n return \"boolean\";\n case \"string\":\n return \"string\";\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n return \"number\";\n case \"date\":\n return \"LocalDate\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"attachment\":\n return \"Attachment\";\n case \"array\":\n return `Array<${handleQueryDataType(dataType.subType, importedObjects)}>`;\n case \"object\":\n {\n const objectType = dataType.objectTypeApiName;\n importedObjects.add(objectType);\n return objectType;\n }\n case \"objectSet\":\n {\n const objectType = dataType.objectTypeApiName;\n importedObjects.add(objectType);\n return `ObjectSet<${objectType}>`;\n }\n case \"set\":\n return `Set<${handleQueryDataType(dataType.subType, importedObjects)}>`;\n case \"struct\":\n const properties = dataType.fields.map(field => {\n const isNullable = isNullableQueryDataType(field.fieldType);\n return `${field.name}${isNullable ? \"?\" : \"\"}: ${handleQueryDataType(field.fieldType, importedObjects)}`;\n });\n return `{ ${properties.join(\",\\n\")} }`;\n case \"union\":\n return dataType.unionTypes.map(type => handleQueryDataType(type, importedObjects)).filter(type => type !== \"null\").join(\"|\");\n case \"twoDimensionalAggregation\":\n dataType.valueType;\n return `TwoDimensionalAggregation<\n ${aggregationKeyToTypescriptType(dataType.keyType)},\n ${aggregationValueToTypescriptType(dataType.valueType)}\n >`;\n case \"threeDimensionalAggregation\":\n return `ThreeDimensionalAggregation<\n ${aggregationKeyToTypescriptType(dataType.keyType)},\n ${aggregationKeyToTypescriptType(dataType.valueType.keyType)},\n ${aggregationValueToTypescriptType(dataType.valueType.valueType)}\n >`;\n case \"null\":\n return \"null\";\n case \"unsupported\":\n throw new Error(\"Cannot generate queries for unsupported type\");\n default:\n const _ = dataType;\n throw new Error(`Cannot generate queries for type ${dataType.type}`);\n }\n}\nfunction aggregationKeyToTypescriptType(keyType) {\n switch (keyType.type) {\n case \"boolean\":\n return \"boolean\";\n case \"double\":\n case \"integer\":\n return \"number\";\n case \"string\":\n return \"string\";\n case \"date\":\n return \"LocalDate\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"range\":\n return `Range<${aggregationRangeToTypescriptType(keyType.subType)}>`;\n default:\n const _ = keyType;\n throw new Error(`Unknown TwoDimensionalAggregation keyType ${keyType.type}`);\n }\n}\nfunction aggregationRangeToTypescriptType(subType) {\n switch (subType.type) {\n case \"date\":\n return \"LocalDate\";\n case \"double\":\n case \"integer\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n default:\n const _ = subType;\n throw new Error(`Unsupported QueryAggregationRangeSubType ${subType.type}`);\n }\n}\nfunction aggregationValueToTypescriptType(valueType) {\n switch (valueType.type) {\n case \"date\":\n return \"LocalDate\";\n case \"double\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n default:\n const _ = valueType;\n throw new Error(`Unsupported QueryAggregationValueType ${valueType.type}`);\n }\n}\nfunction sanitizeDocTypeName(type) {\n return type.replace(/\\s/g, \"\");\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireObjectTypeV2ToSdkObjectDefinition } from \"../shared/wireObjectTypeV2ToSdkObjectDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nimport { wireObjectTypeV2ToObjectDefinitionInterfaceString } from \"./wireObjectTypeV2ToObjectDefinitionInterfaceString\";\nexport async function generateClientSdkVersionTwoPointZero(ontology, fs, outDir) {\n fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export { Ontology } from \"./Ontology\";\n `));\n const objectNames = Object.keys(ontology.objectTypes);\n fs.writeFile(path.join(outDir, \"Ontology.ts\"), await formatTs(`\n import type { OntologyDefinition } from \"@osdk/api\";\n ${objectNames.map(name => `import {${name}} from \"./objects/${name}\";`).join(\"\\n\")}\n ${/* FIXME: Generate this file */\"\"}\n import { OntologyMetadata } from \"./OntologyMetadata\";\n \n export const Ontology = {\n metadata: OntologyMetadata,\n objects: {\n ${objectNames.map(name => `${name}: ${name},`).join(\"\\n\")}\n },\n } satisfies OntologyDefinition<${objectNames.map(n => `\"${n}\"`).join(\"|\")}>;\n `));\n for (const name of objectNames) {\n const obj = ontology.objectTypes[name];\n fs.writeFile(path.join(outDir, `objects`, `${name}.ts`), await formatTs(`\n \n import type { ObjectDefinition } from \"@osdk/api\";\n\n export const ${name} = ${JSON.stringify(wireObjectTypeV2ToSdkObjectDefinition(obj), null, 2)} satisfies ${name};\n\n ${wireObjectTypeV2ToObjectDefinitionInterfaceString(obj)}\n `));\n }\n}","/*\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 */\n\nexport function wireObjectTypeV2ToObjectDefinitionInterfaceString(input) {\n return `\n export interface ${input.apiName} extends ObjectDefinition<\"${input.apiName}\", \"${input.apiName}\">{\n apiName: \"${input.apiName}\";\n properties: {\n ${Object.entries(input.properties).map(([key, value]) => `\n /**\n * ${value.description ?? \"\"}\n **/\n ${key}: {\n type: \"${value.dataType.type}\";\n displayName: \"${value.displayName ?? key}\";\n }\n \n `)}\n }\n }\n `;\n}"]}
1
+ {"version":3,"sources":["../../src/v1.1/generateClientSdkVersionOneDotOne.ts","../../src/shared/sanitizeMetadata.ts","../../src/v1.1/generateActions.ts","../../src/shared/getEditedEntities.ts","../../src/util/test/formatTs.ts","../../src/v1.1/generateFoundryClientFile.ts","../../src/v1.1/generateIndexFile.ts","../../src/v1.1/generateMetadataFile.ts","../../src/util/commaSeparatedIdentifiers.ts","../../src/util/commaSeparatedTypeIdentifiers.ts","../../src/v1.1/generateObjectsInterfaceFile.ts","../../src/v1.1/generateOntologyIndexFile.ts","../../src/v1.1/generatePerActionDataFiles.ts","../../src/shared/wireActionTypeV2ToSdkActionDefinition.ts","../../src/v1.1/generatePerObjectInterfaceAndDataFiles.ts","../../src/shared/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/shared/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/shared/wireObjectTypeV2ToSdkObjectDefinition.ts","../../src/util/reservedKeywords.ts","../../src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts","../../src/v1.1/generatePerQueryDataFiles.ts","../../src/shared/isNullableQueryDataType.ts","../../src/shared/wireQueryDataTypeToQueryDataTypeDefinition.ts","../../src/shared/wireQueryTypeV2ToSdkQueryDefinition.ts","../../src/v1.1/generateQueries.ts","../../src/v2.0/generateClientSdkVersionTwoPointZero.ts","../../src/v2.0/wireObjectTypeV2ToObjectDefinitionInterfaceString.ts"],"names":["path","sanitizeMetadata","ontology","actionType","camelize","name","segment","getModifiedEntityTypes","action","addedObjects","modifiedObjects","operation","_","format","organizeImports","formatTs","contents","generateActions","fs","outDir","importedObjects","actionSignatures","entries","modifiedEntityTypes","jsDocBlock","parameterBlock","parameterName","parameterData","typeScriptType","getTypeScriptTypeFromDataType","importedObject","actionParameter","objectType","generateFoundryClientFile","generateIndexFile","commaSeparatedIdentifiers","identifiers","alternateNames","i","alt","commaSeparatedTypeIdentifiers","altNames","generateMetadataFile","objectNames","actionNames","queryNames","query","actionAltNames","queryAltNames","seenIdentifiers","actionName","queryName","getImportClause","n","queryType","generateObjectsInterfaceFile","apiName","generateOntologyIndexFile","wireActionTypeV2ToSdkActionDefinition","input","key","value","wireActionParameterV2ToSdkParameterDefinition","createModifiedEntities","actionPropertyToSdkPropertyDefinition","parameterType","entities","generatePerActionDataFiles","uniqueApiNames","extractReferencedObjectsFromAction","referencedObjectsInParameters","dataType","objectTypeReference","extractReferencedObjectsFromActionParameter","wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","objectPropertyTypeToSdkPropertyDefinition","propertyType","wireObjectTypeV2ToSdkObjectDefinition","linkTypes","linkType","reservedKeywords","isReservedKeyword","wireObjectTypeV2ToObjectInterfaceStringV1","uniqueLinkTargets","a","linkTarget","getDescriptionIfPresent","wirePropertyTypeV2ToTypeScriptType","propertyName","propertyDefinition","property","description","generatePerObjectInterfaceAndDataFiles","object","links","isNullableQueryDataType","t","wireQueryDataTypeToQueryDataTypeDefinition","allowNulls","nonnull","acc","f","get2DQueryAggregationProps","get3DQueryAggregationProps","guardInvalidKeyTypes","wireQueryTypeV2ToSdkQueryDefinition","parameter","wireQueryParameterV2ToQueryParameterDefinition","generatePerQueryDataFiles","objectTypes","getObjectTypesFromQuery","types","getObjectTypesFromDataType","prop","type","generateQueries","signatures","outputType","handleQueryDataType","paramEntries","nullable","sanitizeDocTypeName","param","field","isNullable","aggregationKeyToTypescriptType","aggregationValueToTypescriptType","keyType","aggregationRangeToTypescriptType","subType","valueType","generateClientSdkVersionOneDotOne","objectsDir","actionsDir","queriesDir","sanitizedOntology","wireObjectTypeV2ToObjectDefinitionInterfaceString","generateClientSdkVersionTwoPointZero","obj"],"mappings":"AAgBA,UAAYA,MAAU,OCAf,SAASC,EAAiBC,EAAU,CACzC,MAAO,CACL,GAAGA,EACH,YAAaA,EAAS,YAAY,IAAIC,IAC7B,CACL,GAAGA,EACH,QAASC,GAASD,EAAW,OAAO,CACtC,EACD,CACH,CACF,CACA,SAASC,GAASC,EAAM,CACtB,OAAOA,EAAK,QAAQ,MAAOC,GAAWA,EAAQ,CAAC,EAAE,YAAY,CAAC,CAChE,CCbA,OAAON,OAAU,OCAV,SAASO,EAAuBC,EAAQ,CAC7C,IAAMC,EAAe,IAAI,IACnBC,EAAkB,IAAI,IAC5B,QAAWC,KAAaH,EAAO,WAC7B,OAAQG,EAAU,KAAM,CACtB,IAAK,eACHF,EAAa,IAAIE,EAAU,iBAAiB,EAC5C,MACF,IAAK,eACHD,EAAgB,IAAIC,EAAU,iBAAiB,EAC/C,MACF,IAAK,eACL,IAAK,aACL,IAAK,aACH,MACF,QACE,IAAMC,EAAID,CACd,CAEF,MAAO,CACL,aAAAF,EACA,gBAAAC,CACF,CACF,CCvBA,OAAS,UAAAG,OAAc,WAGvB,OAAOC,OAAqB,mCACrB,SAASC,EAASC,EAAU,CACjC,OAAOH,GAAOG,EAAU,CACtB,OAAQ,aACR,YAAa,GACb,cAAe,MACf,QAAS,CAACF,EAAe,EACzB,SAAU,EACV,WAAY,GACd,CAAC,CACH,CFVA,eAAsBG,EAAgBf,EAAUgB,EAAIC,EAAQ,CAC1D,IAAMC,EAAkB,IAAI,IACxBC,EAAmB,CAAC,EACxB,QAAWb,KAAUN,EAAS,YAAa,CACzC,IAAMoB,EAAU,OAAO,QAAQd,EAAO,UAAU,EAC1Ce,EAAsBhB,EAAuBC,CAAM,EACnDC,EAAe,MAAM,KAAKc,EAAoB,YAAY,EAC1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J,CACF","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 */\n\nimport * as path from \"node:path\";\nimport { sanitizeMetadata } from \"../shared/sanitizeMetadata\";\nimport { generateActions } from \"./generateActions\";\nimport { generateFoundryClientFile } from \"./generateFoundryClientFile\";\nimport { generateIndexFile } from \"./generateIndexFile\";\nimport { generateMetadataFile } from \"./generateMetadataFile\";\nimport { generateObjectsInterfaceFile } from \"./generateObjectsInterfaceFile\";\nimport { generateOntologyIndexFile } from \"./generateOntologyIndexFile\";\nimport { generatePerActionDataFiles } from \"./generatePerActionDataFiles\";\nimport { generatePerObjectInterfaceAndDataFiles } from \"./generatePerObjectInterfaceAndDataFiles\";\nimport { generatePerQueryDataFiles } from \"./generatePerQueryDataFiles\";\nimport { generateQueries } from \"./generateQueries\";\nexport async function generateClientSdkVersionOneDotOne(ontology, fs, outDir) {\n const objectsDir = path.join(outDir, \"ontology\", \"objects\");\n const actionsDir = path.join(outDir, \"ontology\", \"actions\");\n const queriesDir = path.join(outDir, \"ontology\", \"queries\");\n const sanitizedOntology = sanitizeMetadata(ontology);\n await generateFoundryClientFile(fs, outDir);\n await generateMetadataFile(sanitizedOntology, fs, outDir);\n await generateOntologyIndexFile(fs, path.join(outDir, \"ontology\"));\n await generateObjectsInterfaceFile(sanitizedOntology, fs, objectsDir);\n await generatePerObjectInterfaceAndDataFiles(sanitizedOntology, fs, objectsDir);\n await generateActions(sanitizedOntology, fs, actionsDir);\n await generatePerActionDataFiles(sanitizedOntology, fs, actionsDir);\n await generateQueries(sanitizedOntology, fs, queriesDir);\n await generatePerQueryDataFiles(sanitizedOntology, fs, queriesDir);\n await generateIndexFile(fs, outDir);\n}","/*\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 */\n\nexport function sanitizeMetadata(ontology) {\n return {\n ...ontology,\n actionTypes: ontology.actionTypes.map(actionType => {\n return {\n ...actionType,\n apiName: camelize(actionType.apiName)\n };\n })\n };\n}\nfunction camelize(name) {\n return name.replace(/-./g, segment => segment[1].toUpperCase());\n}","/*\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 */\n\nimport path from \"path\";\nimport { getModifiedEntityTypes } from \"../shared/getEditedEntities\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateActions(ontology, fs, outDir) {\n const importedObjects = new Set();\n let actionSignatures = [];\n for (const action of ontology.actionTypes) {\n const entries = Object.entries(action.parameters);\n const modifiedEntityTypes = getModifiedEntityTypes(action);\n const addedObjects = Array.from(modifiedEntityTypes.addedObjects);\n const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);\n addedObjects.forEach(importedObjects.add, importedObjects);\n modifiedObjects.forEach(importedObjects.add, importedObjects);\n let jsDocBlock = [\"/**\"];\n if (action.description) {\n jsDocBlock.push(`* ${action.description}`);\n }\n let parameterBlock = \"\";\n if (entries.length > 0) {\n parameterBlock = `params: { \\n`;\n for (const [parameterName, parameterData] of entries) {\n parameterBlock += `\"${parameterName}\"`;\n parameterBlock += parameterData.required ? \": \" : \"?: \";\n const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);\n parameterBlock += `${typeScriptType};\\n`;\n jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);\n }\n parameterBlock += \"}, \";\n }\n jsDocBlock.push(`*/`);\n actionSignatures.push(`\n ${jsDocBlock.join(\"\\n\")}\n ${action.apiName}<O extends ActionExecutionOptions>(${parameterBlock}options?: O): \n Promise<Result<ActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(\" | \") : \"void\"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(\" | \") : \"void\"}>>, ActionError>>;`);\n }\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Actions.ts\"), await formatTs(`\n import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, ActionError, Result, ActionResponseFromOptions } from \"@osdk/legacy-client\";\n ${Array.from(importedObjects).map(importedObject => `import type { ${importedObject} } from \"../objects/${importedObject}\";`).join(\"\\n\")}\n export interface Actions {\n ${actionSignatures.join(\"\\n\")}\n }\n `));\n}\nfunction getTypeScriptTypeFromDataType(actionParameter, importedObjects) {\n switch (actionParameter.type) {\n case \"objectSet\":\n {\n const objectType = actionParameter.objectTypeApiName;\n importedObjects.add(objectType);\n return `ObjectSet<${objectType}>`;\n }\n case \"object\":\n {\n const objectType = actionParameter.objectTypeApiName;\n importedObjects.add(objectType);\n return `${objectType} | ${objectType}[\"__primaryKey\"]`;\n }\n case \"array\":\n return `Array<${getTypeScriptTypeFromDataType(actionParameter.subType, importedObjects)}>`;\n case \"string\":\n return `string`;\n case \"boolean\":\n return `boolean`;\n case \"attachment\":\n return `Attachment`;\n case \"date\":\n return `LocalDate`;\n case \"double\":\n case \"integer\":\n case \"long\":\n return `number`;\n case \"timestamp\":\n return `Timestamp`;\n default:\n const _ = actionParameter;\n throw new Error(`Unsupported action parameter type: ${actionParameter}`);\n }\n}","/*\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 */\n\nexport function getModifiedEntityTypes(action) {\n const addedObjects = new Set();\n const modifiedObjects = new Set();\n for (const operation of action.operations) {\n switch (operation.type) {\n case \"createObject\":\n addedObjects.add(operation.objectTypeApiName);\n break;\n case \"modifyObject\":\n modifiedObjects.add(operation.objectTypeApiName);\n break;\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n break;\n default:\n const _ = operation;\n }\n }\n return {\n addedObjects,\n modifiedObjects\n };\n}","/*\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 */\n\nimport { format } from \"prettier\";\n// @ts-ignore the plugin doesn't have types but we need to import the actual plugin\n// so we can bundle it rather than trying to resolve it at runtime\nimport organizeImports from \"prettier-plugin-organize-imports\";\nexport function formatTs(contents) {\n return format(contents, {\n parser: \"typescript\",\n singleQuote: true,\n trailingComma: \"all\",\n plugins: [organizeImports],\n tabWidth: 2,\n printWidth: 120\n });\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateFoundryClientFile(fs, outDir) {\n await fs.writeFile(path.join(outDir, \"FoundryClient.ts\"), await formatTs(`\n import { BaseFoundryClient } from \"@osdk/legacy-client\";\n import type { Auth, FoundryClientOptions } from \"@osdk/legacy-client\";\n import { Ontology } from \"./Ontology\";\n\n export class FoundryClient<TAuth extends Auth = Auth> extends BaseFoundryClient<typeof Ontology, TAuth> {\n constructor(options: FoundryClientOptions<TAuth>) {\n super(options, Ontology);\n }\n\n get ontology(): Ontology {\n return super.ontology;\n }\n }`));\n}","/*\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 */\n\nimport * as path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateIndexFile(fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export {\n ActionExecutionMode,\n ActionResponse,\n ActionValidationResult, \n ArrayType,\n AttachmentType,\n BooleanType,\n ByteType,\n DateType,\n DecimalType,\n DoubleType,\n FloatType,\n FoundryApiError,\n GeoPoint,\n GeoPointType,\n GeoShape,\n GeoShapeType,\n IntegerType,\n isErr,\n isOk, \n LocalDate,\n LongType,\n ObjectType,\n Op,\n Polygon,\n ReturnEditsMode,\n SetType,\n ShortType,\n StringType,\n StructField,\n StructType,\n TimeSeriesType,\n Timestamp,\n TimestampType,\n visitError,\n PublicClientAuth,\n ConfidentialClientAuth,\n UserTokenAuth\n } from '@osdk/legacy-client';\n export type {\n ActionError,\n AggregateObjectsError,\n AggregationGroup,\n AggregationResult, \n Attachment,\n AttachmentMetadata, \n AttachmentsError,\n Edits,\n ErrorVisitor,\n GetLinkedObjectError,\n GetObjectError,\n ListLinkedObjectsError,\n ListObjectsError,\n LoadObjectSetError,\n Page,\n PermissionDenied,\n QueryError,\n QueryResponse, \n Result,\n SearchObjectsError,\n TimeSeries,\n TimeSeriesError,\n TimeSeriesPoint, \n Unauthorized,\n UnknownError, \n } from '@osdk/legacy-client';\n export { Ontology } from \"./Ontology\";\n export { FoundryClient } from \"./FoundryClient\";\n `));\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { commaSeparatedIdentifiers } from \"../util/commaSeparatedIdentifiers\";\nimport { commaSeparatedTypeIdentifiers } from \"../util/commaSeparatedTypeIdentifiers\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateMetadataFile(ontology, fs, outDir) {\n const objectNames = Object.keys(ontology.objectTypes);\n const actionNames = ontology.actionTypes.map(action => action.apiName);\n const queryNames = ontology.queryTypes.map(query => query.apiName);\n const actionAltNames = new Map();\n const queryAltNames = new Map();\n const seenIdentifiers = new Set(objectNames);\n for (const actionName of actionNames) {\n if (seenIdentifiers.has(actionName)) {\n actionAltNames.set(actionName, `${actionName}Action`);\n } else {\n seenIdentifiers.add(actionName);\n }\n }\n for (const queryName of queryNames) {\n if (seenIdentifiers.has(queryName)) {\n queryAltNames.set(queryName, `${queryName}Query`);\n }\n }\n const getImportClause = (name, altNames) => {\n const alt = altNames.get(name);\n if (alt) {\n return `${name} as ${alt}`;\n } else {\n return name;\n }\n };\n await fs.writeFile(path.join(outDir, \"Ontology.ts\"), await formatTs(`\n import type { OntologyDefinition } from \"@osdk/api\";\n import type { Ontology as ClientOntology } from \"@osdk/legacy-client\";\n import type { Objects } from \"./ontology/objects/Objects\";\n import type { Actions } from \"./ontology/actions/Actions\";\n import type { Queries } from \"./ontology/queries/Queries\";\n ${objectNames.map(name => `import {${name}} from \"./ontology/objects/${name}\";`).join(\"\\n\")}\n ${actionNames.map(name => `import {${getImportClause(name, actionAltNames)}} from \"./ontology/actions/${name}\";`).join(\"\\n\")}\n ${queryNames.map(name => `import {${getImportClause(name, queryAltNames)}} from \"./ontology/queries/${name}\";`).join(\"\\n\")}\n\n export const Ontology : {\n metadata: {\n ontologyRid: \"${ontology.rid}\",\n ontologyApiName: \"${ontology.apiName}\",\n userAgent: \"foundry-typescript-osdk/0.0.1\",\n },\n objects: {\n ${commaSeparatedTypeIdentifiers(objectNames)}\n },\n actions: {\n ${commaSeparatedTypeIdentifiers(actionNames, actionAltNames)}\n },\n queries: {\n ${commaSeparatedTypeIdentifiers(queryNames, queryAltNames)}\n },\n } = {\n metadata: {\n ontologyRid: \"${ontology.rid}\" as const,\n ontologyApiName: \"${ontology.apiName}\" as const,\n userAgent: \"foundry-typescript-osdk/0.0.1\" as const,\n },\n objects: {\n ${commaSeparatedIdentifiers(objectNames)}\n },\n actions: {\n ${commaSeparatedIdentifiers(actionNames, actionAltNames)}\n },\n queries: {\n ${commaSeparatedIdentifiers(queryNames, queryAltNames)}\n }\n } satisfies OntologyDefinition<${objectNames.map(n => `\"${n}\"`).join(\"|\")}, ${ontology.actionTypes.map(actionType => `\"${actionType.apiName}\"`).join(\"|\")}, ${ontology.queryTypes.map(queryType => `\"${queryType.apiName}\"`).join(\"|\")}>;\n \nexport interface Ontology extends ClientOntology<typeof Ontology> {\n objects: Objects;\n actions: Actions;\n queries: Queries;\n}`));\n}","/*\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 */\n\nexport function commaSeparatedIdentifiers(identifiers, alternateNames) {\n return identifiers.map(i => {\n const alt = alternateNames?.get(i);\n if (alt) {\n return `${i}: ${alt}`;\n }\n return i;\n }).join(\",\");\n}","/*\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 */\n\nexport function commaSeparatedTypeIdentifiers(identifiers, altNames) {\n return identifiers.map(i => `${i}: typeof ${altNames?.get(i) ?? i}`).join(\",\");\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateObjectsInterfaceFile(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Objects.ts\"), await formatTs(`\n import { BaseObjectSet } from \"@osdk/legacy-client\";\n ${Array.from(Object.keys(ontology.objectTypes)).map(importedObject => `import type { ${importedObject} } from \"./${importedObject}\";`).join(\"\\n\")}\n \n export interface Objects {\n ${Object.keys(ontology.objectTypes).map(apiName => `${apiName} : BaseObjectSet<${apiName}>;`).join(\"\\n\")}\n }\n ;`));\n}","/*\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 */\n\nimport * as path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateOntologyIndexFile(fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export type { ObjectSet } from \"@osdk/legacy-client\";\n `));\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireActionTypeV2ToSdkActionDefinition } from \"../shared/wireActionTypeV2ToSdkActionDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generatePerActionDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(ontology.actionTypes.map(async action => {\n const uniqueApiNames = new Set(extractReferencedObjectsFromAction(action));\n await fs.writeFile(path.join(outDir, `${action.apiName}.ts`), await formatTs(`\n import { ActionDefinition } from \"@osdk/api\";\n \n export const ${action.apiName} = ${JSON.stringify(wireActionTypeV2ToSdkActionDefinition(action), null, 2)} satisfies ActionDefinition<\"${action.apiName}\", ${uniqueApiNames.size > 0 ? [...uniqueApiNames].map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, `index.ts`), await formatTs(`\n ${ontology.actionTypes.map(action => `export * from \"./${action.apiName}\";`).join(\"\\n\")}\n `));\n}\nfunction extractReferencedObjectsFromAction(actionType) {\n const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({\n dataType\n }) => {\n const objectTypeReference = extractReferencedObjectsFromActionParameter(dataType);\n return objectTypeReference ? [objectTypeReference] : [];\n });\n const referenceObjectsInEdits = actionType.operations.flatMap(value => {\n switch (value.type) {\n case \"createObject\":\n return [value.objectTypeApiName];\n case \"modifyObject\":\n return [value.objectTypeApiName];\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n return [];\n }\n });\n return [...referenceObjectsInEdits, ...referencedObjectsInParameters];\n}\nfunction extractReferencedObjectsFromActionParameter(actionParameter) {\n switch (actionParameter.type) {\n case \"objectSet\":\n case \"object\":\n return actionParameter.objectTypeApiName;\n case \"array\":\n return extractReferencedObjectsFromActionParameter(actionParameter.subType);\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"date\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"timestamp\":\n return undefined;\n }\n}","/*\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 */\n\nimport { getModifiedEntityTypes } from \"./getEditedEntities\";\nexport function wireActionTypeV2ToSdkActionDefinition(input) {\n const modifiedEntityTypes = getModifiedEntityTypes(input);\n return {\n apiName: input.apiName,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([key, value]) => [key, wireActionParameterV2ToSdkParameterDefinition(value)])),\n displayName: input.displayName,\n description: input.description,\n modifiedEntities: createModifiedEntities(modifiedEntityTypes.addedObjects, modifiedEntityTypes.modifiedObjects)\n };\n}\nfunction wireActionParameterV2ToSdkParameterDefinition(value) {\n switch (value.dataType.type) {\n case \"string\":\n case \"boolean\":\n case \"object\":\n case \"attachment\":\n case \"date\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"objectSet\":\n case \"timestamp\":\n return {\n multiplicity: false,\n type: actionPropertyToSdkPropertyDefinition(value.dataType),\n nullable: value.required ? false : true,\n description: value.description\n };\n case \"array\":\n return {\n multiplicity: true,\n type: actionPropertyToSdkPropertyDefinition(value.dataType),\n nullable: value.required ? false : true,\n description: value.description\n };\n }\n}\nfunction actionPropertyToSdkPropertyDefinition(parameterType) {\n switch (parameterType.type) {\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"timestamp\":\n return parameterType.type;\n case \"date\":\n return \"datetime\";\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: parameterType.objectTypeApiName\n };\n case \"object\":\n return {\n type: \"object\",\n object: parameterType.objectTypeApiName\n };\n case \"array\":\n return actionPropertyToSdkPropertyDefinition(parameterType.subType);\n }\n}\nfunction createModifiedEntities(addedObjects, modifiedObjects) {\n let entities = {};\n for (const key of addedObjects) {\n entities[key] = {\n created: true,\n modified: false\n };\n }\n for (const key of modifiedObjects) {\n if (entities[key]) {\n entities[key].modified = true;\n } else {\n entities[key] = {\n created: false,\n modified: true\n };\n }\n }\n return entities;\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireObjectTypeV2ToSdkObjectDefinition } from \"../shared/wireObjectTypeV2ToSdkObjectDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nimport { wireObjectTypeV2ToObjectInterfaceStringV1 } from \"./wireObjectTypeV2ToV1ObjectInterfaceString\";\nexport async function generatePerObjectInterfaceAndDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(Object.values(ontology.objectTypes).map(async object => {\n const links = ontology.linkTypes[object.apiName];\n const uniqueApiNames = new Set(links?.map(a => a.objectTypeApiName));\n await fs.writeFile(path.join(outDir, `${object.apiName}.ts`), await formatTs(`\n import { ObjectDefinition } from \"@osdk/api\";\n ${wireObjectTypeV2ToObjectInterfaceStringV1(object, links)}\n\n export const ${object.apiName} = ${JSON.stringify(wireObjectTypeV2ToSdkObjectDefinition(object, links), null, 2)} satisfies ObjectDefinition<\"${object.apiName}\", ${uniqueApiNames.size > 0 ? [...uniqueApiNames].map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n ${Object.keys(ontology.objectTypes).map(apiName => `export * from \"./${apiName}\";`).join(\"\\n\")}\n export type { ObjectSet } from \"@osdk/legacy-client\";\\n\n `));\n}","/*\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 */\n\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"byte\":\n case \"decimal\":\n case \"float\":\n case \"geopoint\":\n case \"geoshape\":\n case \"long\":\n case \"short\":\n {\n return input.dataType.type;\n }\n case \"date\":\n {\n return \"datetime\";\n }\n case \"timestamp\":\n {\n return \"timestamp\";\n }\n case \"timeseries\":\n case \"array\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}","/*\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 */\n\nexport function wirePropertyV2ToSdkPropertyDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"date\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n return {\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n case \"array\":\n {\n return {\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n }\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\n switch (propertyType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n return propertyType.type;\n case \"date\":\n return \"datetime\";\n case \"array\":\n return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);\n case \"timeseries\":\n if (propertyType.itemType.type === \"string\") {\n return \"stringTimeseries\";\n }\n return \"numericTimeseries\";\n default:\n const _ = propertyType;\n throw new Error(`Unexecpected data type ${propertyType}`);\n }\n}","/*\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 */\n\nimport { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition\";\nexport function wireObjectTypeV2ToSdkObjectDefinition(input, linkTypes = []) {\n return {\n apiName: input.apiName,\n description: input.description,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input.properties[input.primaryKey]),\n links: Object.fromEntries(linkTypes.map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName\n }];\n })),\n properties: Object.fromEntries(Object.entries(input.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value)]))\n };\n}","/*\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 */\n\n// This must match the reservedKeywords definition in packages/legacy-client\nconst reservedKeywords = new Set([\"break\", \"case\", \"catch\", \"class\", \"const\", \"continue\", \"debugger\", \"default\", \"delete\", \"do\", \"else\", \"enum\", \"export\", \"extends\", \"false\", \"finally\", \"for\", \"function\", \"if\", \"import\", \"in\", \"instanceof\", \"new\", \"null\", \"return\", \"super\", \"switch\", \"this\", \"throw\", \"true\", \"try\", \"typeof\", \"var\", \"void\", \"while\", \"with\", \"implements\", \"interface\", \"let\", \"package\", \"private\", \"protected\", \"public\", \"static\", \"yield\"]);\nexport function isReservedKeyword(name) {\n return reservedKeywords.has(name);\n}","/*\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 */\n\nimport { isReservedKeyword } from \"../util/reservedKeywords\";\nexport function wireObjectTypeV2ToObjectInterfaceStringV1(input, linkTypes = []) {\n const uniqueLinkTargets = new Set(linkTypes.map(a => a.objectTypeApiName).filter(a => a !== input.apiName));\n return `import type { OntologyObject, LocalDate, Timestamp, GeoShape, GeoPoint, Attachment, TimeSeries, MultiLink, SingleLink } from \"@osdk/legacy-client\";\n${Array.from(uniqueLinkTargets).map(linkTarget => `import type { ${linkTarget} } from \"./${linkTarget}\";`).join(\"\\n\")}\n\n ${getDescriptionIfPresent(input.description)}export interface ${input.apiName} extends OntologyObject {\n readonly __apiName: \"${input.apiName}\";\n readonly __primaryKey: ${wirePropertyTypeV2ToTypeScriptType(input.properties[input.primaryKey].dataType)};\n${Object.entries(input.properties).flatMap(([propertyName, propertyDefinition]) => {\n const propertyType = wirePropertyTypeV2ToTypeScriptType(propertyDefinition.dataType);\n const entries = [`${getDescriptionIfPresent(propertyDefinition.description)}readonly ${propertyName}: ${propertyType} | undefined`];\n if (isReservedKeyword(propertyName)) {\n entries.push(`/** @deprecated please migrate to '${propertyName}' instead */\n readonly ${propertyName}_: ${propertyType} | undefined`);\n }\n return entries;\n }).join(\";\\n\")}\n${linkTypes.flatMap(linkType => {\n const entries = [`readonly ${linkType.apiName}: ${linkType.cardinality === \"MANY\" ? \"MultiLink\" : \"SingleLink\"}<${linkType.objectTypeApiName}>`];\n return entries;\n }).join(\";\\n\")}\n}\n `;\n}\nfunction wirePropertyTypeV2ToTypeScriptType(property) {\n switch (property.type) {\n case \"string\":\n return \"string\";\n case \"boolean\":\n return \"boolean\";\n case \"array\":\n return wirePropertyTypeV2ToTypeScriptType(property.subType) + \"[]\";\n case \"integer\":\n return \"number\";\n case \"attachment\":\n return \"Attachment\";\n case \"byte\":\n return \"number\";\n case \"date\":\n return \"LocalDate\";\n case \"decimal\":\n return \"number\";\n case \"double\":\n return \"number\";\n case \"float\":\n return \"number\";\n case \"geopoint\":\n return \"GeoPoint\";\n case \"geoshape\":\n return \"GeoShape\";\n case \"long\":\n return \"number\";\n case \"short\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"timeseries\":\n return property.itemType.type === \"string\" ? `TimeSeries<string>` : `TimeSeries<number>`;\n default:\n const _ = property;\n throw new Error(`Unknown property type ${property}`);\n }\n}\nfunction getDescriptionIfPresent(description) {\n if (description) {\n return `/**\n * ${description}\n */\\n`;\n }\n return \"\";\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireQueryTypeV2ToSdkQueryDefinition } from \"../shared/wireQueryTypeV2ToSdkQueryDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generatePerQueryDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(ontology.queryTypes.map(async query => {\n const objectTypes = getObjectTypesFromQuery(query);\n await fs.writeFile(path.join(outDir, `${query.apiName}.ts`), await formatTs(`\n import { QueryDefinition } from \"@osdk/api\";\n\n export const ${query.apiName} = ${JSON.stringify(wireQueryTypeV2ToSdkQueryDefinition(query))} satisfies QueryDefinition<\"${query.apiName}\", ${objectTypes.length > 0 ? objectTypes.map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n ${ontology.queryTypes.map(query => `export * from \"./${query.apiName}\";`).join(\"\\n\")}\n `));\n}\nfunction getObjectTypesFromQuery(query) {\n const types = new Set();\n for (const {\n dataType\n } of Object.values(query.parameters)) {\n getObjectTypesFromDataType(dataType, types);\n }\n getObjectTypesFromDataType(query.output, types);\n return Array.from(types);\n}\nfunction getObjectTypesFromDataType(dataType, types) {\n switch (dataType.type) {\n case \"array\":\n case \"set\":\n getObjectTypesFromDataType(dataType.subType, types);\n return;\n case \"object\":\n types.add(dataType.objectTypeApiName);\n return;\n case \"objectSet\":\n types.add(dataType.objectTypeApiName);\n return;\n case \"struct\":\n for (const prop of Object.values(dataType.fields)) {\n getObjectTypesFromDataType(prop.fieldType, types);\n }\n return;\n case \"union\":\n for (const type of dataType.unionTypes) {\n getObjectTypesFromDataType(type, types);\n }\n return;\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"null\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"unsupported\":\n /* complete no-op */\n return;\n default:\n const _ = dataType;\n throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);\n }\n}","/*\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 */\n\nexport function isNullableQueryDataType(input) {\n if (input.type === \"null\") {\n return true;\n }\n if (input.type === \"union\") {\n return input.unionTypes.some(t => isNullableQueryDataType(t));\n }\n return false;\n}","/*\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 */\n\nimport { isNullableQueryDataType } from \"./isNullableQueryDataType\";\nexport function wireQueryDataTypeToQueryDataTypeDefinition(input) {\n switch (input.type) {\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"string\":\n case \"timestamp\":\n return {\n type: input.type,\n nullable: false\n };\n case \"object\":\n return {\n type: {\n type: \"object\",\n object: input.objectTypeApiName\n },\n nullable: false\n };\n case \"objectSet\":\n return {\n type: {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName\n },\n nullable: false\n };\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true\n };\n case \"set\":\n return {\n type: {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType)\n },\n nullable: false\n };\n case \"union\":\n const allowNulls = isNullableQueryDataType(input);\n\n // special case for a union where one half is nullable to skip the union step and just allow nulls directly\n if (allowNulls && input.unionTypes.length === 2) {\n const nonnull = input.unionTypes.find(t => t.type !== null);\n if (nonnull) {\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(nonnull),\n nullable: true\n };\n }\n }\n return {\n type: {\n type: \"union\",\n union: input.unionTypes.reduce((acc, t) => {\n if (t.type === \"null\") {\n return acc;\n }\n acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));\n return acc;\n }, [])\n },\n nullable: allowNulls\n };\n case \"struct\":\n return {\n type: {\n type: \"struct\",\n struct: Object.fromEntries(input.fields.map(f => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)]))\n },\n nullable: false\n };\n case \"twoDimensionalAggregation\":\n return {\n type: {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input)\n }\n };\n case \"threeDimensionalAggregation\":\n return {\n type: {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input)\n }\n };\n case \"null\":\n case \"unsupported\":\n throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);\n default:\n const _ = input;\n throw new Error(`Unsupported QueryDataType.type ${input.type}`);\n }\n}\nfunction get2DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: input.valueType.type\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: input.valueType.type\n };\n }\n throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);\n }\n}\nfunction get3DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: get2DQueryAggregationProps(input.valueType)\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: get2DQueryAggregationProps(input.valueType)\n };\n }\n throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);\n }\n}\n\n/**\n * Guard against aggregation key types that are allowed by the backend types but are illegal to actually use\n */\nfunction guardInvalidKeyTypes(key) {\n return key.type === \"string\" || key.type === \"boolean\";\n}","/*\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 */\n\nimport { wireQueryDataTypeToQueryDataTypeDefinition } from \"./wireQueryDataTypeToQueryDataTypeDefinition\";\nexport function wireQueryTypeV2ToSdkQueryDefinition(input) {\n return {\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n rid: input.rid,\n version: input.version,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),\n output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)\n };\n}\nfunction wireQueryParameterV2ToQueryParameterDefinition(parameter) {\n return {\n description: parameter.description,\n dataType: wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)\n };\n}","/*\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 */\n\nimport path from \"path\";\nimport { isNullableQueryDataType } from \"../shared/isNullableQueryDataType\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateQueries(ontology, fs, outDir) {\n const importedObjects = new Set();\n const signatures = [];\n for (const query of ontology.queryTypes) {\n const jsDocBlock = [\"/**\"];\n if (query.description) {\n jsDocBlock.push(`* ${query.description}`);\n }\n const outputType = handleQueryDataType(query.output, importedObjects);\n const paramEntries = [];\n for (const [name, parameter] of Object.entries(query.parameters)) {\n const nullable = isNullableQueryDataType(parameter.dataType);\n const type = handleQueryDataType(parameter.dataType, importedObjects);\n paramEntries.push(`\"${name}\"${nullable ? \"?\" : \"\"}: ${type}`);\n jsDocBlock.push(`* @param {${sanitizeDocTypeName(type)}} params.${name}${parameter.description ? ` - ${parameter.description}` : \"\"}`);\n }\n const param = paramEntries.length === 0 ? \"\" : `params: { ${paramEntries.join(\"; \")} }`;\n jsDocBlock.push(`* @returns ${sanitizeDocTypeName(outputType)}`, \"*/\");\n signatures.push(`\n ${jsDocBlock.join(\"\\n\")}\n ${query.apiName}(${param}): Promise<Result<QueryResponse<${outputType}>, QueryError>>;\n `);\n }\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Queries.ts\"), await formatTs(`\n import type { QueryResponse, QueryError, Result, Timestamp, LocalDate, Range, Attachment, ObjectSet, TwoDimensionalAggregation, ThreeDimensionalAggregation } from \"@osdk/legacy-client\";\n ${Array.from(importedObjects).map(importedObject => `import type { ${importedObject} } from \"../objects/${importedObject}\";`).join(\"\\n\")}\n\n export interface Queries {\n ${signatures.join(\"\\n\")}\n }\n `));\n}\nfunction handleQueryDataType(dataType, importedObjects) {\n switch (dataType.type) {\n case \"boolean\":\n return \"boolean\";\n case \"string\":\n return \"string\";\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n return \"number\";\n case \"date\":\n return \"LocalDate\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"attachment\":\n return \"Attachment\";\n case \"array\":\n return `Array<${handleQueryDataType(dataType.subType, importedObjects)}>`;\n case \"object\":\n {\n const objectType = dataType.objectTypeApiName;\n importedObjects.add(objectType);\n return `${objectType} | ${objectType}[\"__primaryKey\"]`;\n }\n case \"objectSet\":\n {\n const objectType = dataType.objectTypeApiName;\n importedObjects.add(objectType);\n return `ObjectSet<${objectType}>`;\n }\n case \"set\":\n return `Set<${handleQueryDataType(dataType.subType, importedObjects)}>`;\n case \"struct\":\n const properties = dataType.fields.map(field => {\n const isNullable = isNullableQueryDataType(field.fieldType);\n return `${field.name}${isNullable ? \"?\" : \"\"}: ${handleQueryDataType(field.fieldType, importedObjects)}`;\n });\n return `{ ${properties.join(\",\\n\")} }`;\n case \"union\":\n return dataType.unionTypes.map(type => handleQueryDataType(type, importedObjects)).filter(type => type !== \"null\").join(\"|\");\n case \"twoDimensionalAggregation\":\n dataType.valueType;\n return `TwoDimensionalAggregation<\n ${aggregationKeyToTypescriptType(dataType.keyType)},\n ${aggregationValueToTypescriptType(dataType.valueType)}\n >`;\n case \"threeDimensionalAggregation\":\n return `ThreeDimensionalAggregation<\n ${aggregationKeyToTypescriptType(dataType.keyType)},\n ${aggregationKeyToTypescriptType(dataType.valueType.keyType)},\n ${aggregationValueToTypescriptType(dataType.valueType.valueType)}\n >`;\n case \"null\":\n return \"null\";\n case \"unsupported\":\n throw new Error(\"Cannot generate queries for unsupported type\");\n default:\n const _ = dataType;\n throw new Error(`Cannot generate queries for type ${dataType.type}`);\n }\n}\nfunction aggregationKeyToTypescriptType(keyType) {\n switch (keyType.type) {\n case \"boolean\":\n return \"boolean\";\n case \"double\":\n case \"integer\":\n return \"number\";\n case \"string\":\n return \"string\";\n case \"date\":\n return \"LocalDate\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"range\":\n return `Range<${aggregationRangeToTypescriptType(keyType.subType)}>`;\n default:\n const _ = keyType;\n throw new Error(`Unknown TwoDimensionalAggregation keyType ${keyType.type}`);\n }\n}\nfunction aggregationRangeToTypescriptType(subType) {\n switch (subType.type) {\n case \"date\":\n return \"LocalDate\";\n case \"double\":\n case \"integer\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n default:\n const _ = subType;\n throw new Error(`Unsupported QueryAggregationRangeSubType ${subType.type}`);\n }\n}\nfunction aggregationValueToTypescriptType(valueType) {\n switch (valueType.type) {\n case \"date\":\n return \"LocalDate\";\n case \"double\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n default:\n const _ = valueType;\n throw new Error(`Unsupported QueryAggregationValueType ${valueType.type}`);\n }\n}\nfunction sanitizeDocTypeName(type) {\n return type.replace(/\\s/g, \"\");\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireObjectTypeV2ToSdkObjectDefinition } from \"../shared/wireObjectTypeV2ToSdkObjectDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nimport { wireObjectTypeV2ToObjectDefinitionInterfaceString } from \"./wireObjectTypeV2ToObjectDefinitionInterfaceString\";\nexport async function generateClientSdkVersionTwoPointZero(ontology, fs, outDir) {\n fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export { Ontology } from \"./Ontology\";\n `));\n const objectNames = Object.keys(ontology.objectTypes);\n fs.writeFile(path.join(outDir, \"Ontology.ts\"), await formatTs(`\n import type { OntologyDefinition } from \"@osdk/api\";\n ${objectNames.map(name => `import {${name}} from \"./objects/${name}\";`).join(\"\\n\")}\n ${/* FIXME: Generate this file */\"\"}\n import { OntologyMetadata } from \"./OntologyMetadata\";\n \n export const Ontology = {\n metadata: OntologyMetadata,\n objects: {\n ${objectNames.map(name => `${name}: ${name},`).join(\"\\n\")}\n },\n } satisfies OntologyDefinition<${objectNames.map(n => `\"${n}\"`).join(\"|\")}>;\n `));\n for (const name of objectNames) {\n const obj = ontology.objectTypes[name];\n fs.writeFile(path.join(outDir, `objects`, `${name}.ts`), await formatTs(`\n \n import type { ObjectDefinition } from \"@osdk/api\";\n\n export const ${name} = ${JSON.stringify(wireObjectTypeV2ToSdkObjectDefinition(obj), null, 2)} satisfies ${name};\n\n ${wireObjectTypeV2ToObjectDefinitionInterfaceString(obj)}\n `));\n }\n}","/*\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 */\n\nexport function wireObjectTypeV2ToObjectDefinitionInterfaceString(input) {\n return `\n export interface ${input.apiName} extends ObjectDefinition<\"${input.apiName}\", \"${input.apiName}\">{\n apiName: \"${input.apiName}\";\n properties: {\n ${Object.entries(input.properties).map(([key, value]) => `\n /**\n * ${value.description ?? \"\"}\n **/\n ${key}: {\n type: \"${value.dataType.type}\";\n displayName: \"${value.displayName ?? key}\";\n }\n \n `)}\n }\n }\n `;\n}"]}
@@ -3,7 +3,7 @@ import j__default from 'path';
3
3
  import { format } from 'prettier';
4
4
  import ce from 'prettier-plugin-organize-imports';
5
5
 
6
- function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.apiName)}))}}function ie(e){return e.replace(/-./g,r=>r[1].toUpperCase())}function w(e){let r=new Set,o=new Set;for(let t of e.operations)switch(t.type){case"createObject":r.add(t.objectTypeApiName);break;case"modifyObject":o.add(t.objectTypeApiName);break;}return {addedObjects:r,modifiedObjects:o}}function c(e){return format(e,{parser:"typescript",singleQuote:!0,trailingComma:"all",plugins:[ce],tabWidth:2,printWidth:120})}async function Q(e,r,o){let t=new Set,a=[];for(let n of e.actionTypes){let s=Object.entries(n.parameters),y=w(n),m=Array.from(y.addedObjects),l=Array.from(y.modifiedObjects);m.forEach(t.add,t),l.forEach(t.add,t);let i=["/**"];n.description&&i.push(`* ${n.description}`);let p="";if(s.length>0){p=`params: {
6
+ function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.apiName)}))}}function ie(e){return e.replace(/-./g,r=>r[1].toUpperCase())}function $(e){let r=new Set,o=new Set;for(let t of e.operations)switch(t.type){case"createObject":r.add(t.objectTypeApiName);break;case"modifyObject":o.add(t.objectTypeApiName);break;}return {addedObjects:r,modifiedObjects:o}}function c(e){return format(e,{parser:"typescript",singleQuote:!0,trailingComma:"all",plugins:[ce],tabWidth:2,printWidth:120})}async function Q(e,r,o){let t=new Set,a=[];for(let n of e.actionTypes){let s=Object.entries(n.parameters),y=$(n),m=Array.from(y.addedObjects),l=Array.from(y.modifiedObjects);m.forEach(t.add,t),l.forEach(t.add,t);let i=["/**"];n.description&&i.push(`* ${n.description}`);let p="";if(s.length>0){p=`params: {
7
7
  `;for(let[f,b]of s){p+=`"${f}"`,p+=b.required?": ":"?: ";let E=P(b.dataType,t);p+=`${E};
8
8
  `,i.push(`* @param {${E}} params.${f}`);}p+="}, ";}i.push("*/"),a.push(`
9
9
  ${i.join(`
@@ -17,7 +17,7 @@ function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.
17
17
  ${a.join(`
18
18
  `)}
19
19
  }
20
- `));}function P(e,r){switch(e.type){case"objectSet":{let t=e.objectTypeApiName;return r.add(t),`ObjectSet<${t}>`}case"object":{let t=e.objectTypeApiName;return r.add(t),`${t}`}case"array":return `Array<${P(e.subType,r)}>`;case"string":return "string";case"boolean":return "boolean";case"attachment":return "Attachment";case"date":return "LocalDate";case"double":case"integer":case"long":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported action parameter type: ${e}`)}}async function v(e,r){await e.writeFile(j__default.join(r,"FoundryClient.ts"),await c(`
20
+ `));}function P(e,r){switch(e.type){case"objectSet":{let t=e.objectTypeApiName;return r.add(t),`ObjectSet<${t}>`}case"object":{let t=e.objectTypeApiName;return r.add(t),`${t} | ${t}["__primaryKey"]`}case"array":return `Array<${P(e.subType,r)}>`;case"string":return "string";case"boolean":return "boolean";case"attachment":return "Attachment";case"date":return "LocalDate";case"double":case"integer":case"long":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported action parameter type: ${e}`)}}async function v(e,r){await e.writeFile(j__default.join(r,"FoundryClient.ts"),await c(`
21
21
  import { BaseFoundryClient } from "@osdk/legacy-client";
22
22
  import type { Auth, FoundryClientOptions } from "@osdk/legacy-client";
23
23
  import { Ontology } from "./Ontology";
@@ -99,7 +99,7 @@ function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.
99
99
  } from '@osdk/legacy-client';
100
100
  export { Ontology } from "./Ontology";
101
101
  export { FoundryClient } from "./FoundryClient";
102
- `));}function $(e,r){return e.map(o=>{let t=r?.get(o);return t?`${o}: ${t}`:o}).join(",")}function h(e,r){return e.map(o=>`${o}: typeof ${r?.get(o)??o}`).join(",")}async function I(e,r,o){let t=Object.keys(e.objectTypes),a=e.actionTypes.map(i=>i.apiName),n=e.queryTypes.map(i=>i.apiName),s=new Map,y=new Map,m=new Set(t);for(let i of a)m.has(i)?s.set(i,`${i}Action`):m.add(i);for(let i of n)m.has(i)&&y.set(i,`${i}Query`);let l=(i,p)=>{let f=p.get(i);return f?`${i} as ${f}`:i};await r.writeFile(j__default.join(o,"Ontology.ts"),await c(`
102
+ `));}function w(e,r){return e.map(o=>{let t=r?.get(o);return t?`${o}: ${t}`:o}).join(",")}function h(e,r){return e.map(o=>`${o}: typeof ${r?.get(o)??o}`).join(",")}async function I(e,r,o){let t=Object.keys(e.objectTypes),a=e.actionTypes.map(i=>i.apiName),n=e.queryTypes.map(i=>i.apiName),s=new Map,y=new Map,m=new Set(t);for(let i of a)m.has(i)?s.set(i,`${i}Action`):m.add(i);for(let i of n)m.has(i)&&y.set(i,`${i}Query`);let l=(i,p)=>{let f=p.get(i);return f?`${i} as ${f}`:i};await r.writeFile(j__default.join(o,"Ontology.ts"),await c(`
103
103
  import type { OntologyDefinition } from "@osdk/api";
104
104
  import type { Ontology as ClientOntology } from "@osdk/legacy-client";
105
105
  import type { Objects } from "./ontology/objects/Objects";
@@ -134,13 +134,13 @@ function F(e){return {...e,actionTypes:e.actionTypes.map(r=>({...r,apiName:ie(r.
134
134
  userAgent: "foundry-typescript-osdk/0.0.1" as const,
135
135
  },
136
136
  objects: {
137
- ${$(t)}
137
+ ${w(t)}
138
138
  },
139
139
  actions: {
140
- ${$(a,s)}
140
+ ${w(a,s)}
141
141
  },
142
142
  queries: {
143
- ${$(n,y)}
143
+ ${w(n,y)}
144
144
  }
145
145
  } satisfies OntologyDefinition<${t.map(i=>`"${i}"`).join("|")}, ${e.actionTypes.map(i=>`"${i.apiName}"`).join("|")}, ${e.queryTypes.map(i=>`"${i.apiName}"`).join("|")}>;
146
146
 
@@ -159,10 +159,10 @@ export interface Ontology extends ClientOntology<typeof Ontology> {
159
159
  }
160
160
  ;`));}async function M(e,r){await e.mkdir(r,{recursive:!0}),await e.writeFile(j.join(r,"index.ts"),await c(`
161
161
  export type { ObjectSet } from "@osdk/legacy-client";
162
- `));}function q(e){let r=w(e);return {apiName:e.apiName,parameters:Object.fromEntries(Object.entries(e.parameters).map(([o,t])=>[o,ue(t)])),displayName:e.displayName,description:e.description,modifiedEntities:fe(r.addedObjects,r.modifiedObjects)}}function ue(e){switch(e.dataType.type){case"string":case"boolean":case"object":case"attachment":case"date":case"double":case"integer":case"long":case"objectSet":case"timestamp":return {multiplicity:!1,type:A(e.dataType),nullable:!e.required,description:e.description};case"array":return {multiplicity:!0,type:A(e.dataType),nullable:!e.required,description:e.description}}}function A(e){switch(e.type){case"string":case"boolean":case"attachment":case"double":case"integer":case"long":case"timestamp":return e.type;case"date":return "datetime";case"objectSet":return {type:"objectSet",objectSet:e.objectTypeApiName};case"object":return {type:"object",object:e.objectTypeApiName};case"array":return A(e.subType)}}function fe(e,r){let o={};for(let t of e)o[t]={created:!0,modified:!1};for(let t of r)o[t]?o[t].modified=!0:o[t]={created:!1,modified:!0};return o}async function K(e,r,o){await r.mkdir(o,{recursive:!0}),await Promise.all(e.actionTypes.map(async t=>{let a=new Set(de(t));await r.writeFile(j__default.join(o,`${t.apiName}.ts`),await c(`
162
+ `));}function _(e){let r=$(e);return {apiName:e.apiName,parameters:Object.fromEntries(Object.entries(e.parameters).map(([o,t])=>[o,ue(t)])),displayName:e.displayName,description:e.description,modifiedEntities:fe(r.addedObjects,r.modifiedObjects)}}function ue(e){switch(e.dataType.type){case"string":case"boolean":case"object":case"attachment":case"date":case"double":case"integer":case"long":case"objectSet":case"timestamp":return {multiplicity:!1,type:A(e.dataType),nullable:!e.required,description:e.description};case"array":return {multiplicity:!0,type:A(e.dataType),nullable:!e.required,description:e.description}}}function A(e){switch(e.type){case"string":case"boolean":case"attachment":case"double":case"integer":case"long":case"timestamp":return e.type;case"date":return "datetime";case"objectSet":return {type:"objectSet",objectSet:e.objectTypeApiName};case"object":return {type:"object",object:e.objectTypeApiName};case"array":return A(e.subType)}}function fe(e,r){let o={};for(let t of e)o[t]={created:!0,modified:!1};for(let t of r)o[t]?o[t].modified=!0:o[t]={created:!1,modified:!0};return o}async function K(e,r,o){await r.mkdir(o,{recursive:!0}),await Promise.all(e.actionTypes.map(async t=>{let a=new Set(de(t));await r.writeFile(j__default.join(o,`${t.apiName}.ts`),await c(`
163
163
  import { ActionDefinition } from "@osdk/api";
164
164
 
165
- export const ${t.apiName} = ${JSON.stringify(q(t),null,2)} satisfies ActionDefinition<"${t.apiName}", ${a.size>0?[...a].map(n=>`"${n}"`).join("|"):"never"}>;`));})),await r.writeFile(j__default.join(o,"index.ts"),await c(`
165
+ export const ${t.apiName} = ${JSON.stringify(_(t),null,2)} satisfies ActionDefinition<"${t.apiName}", ${a.size>0?[...a].map(n=>`"${n}"`).join("|"):"never"}>;`));})),await r.writeFile(j__default.join(o,"index.ts"),await c(`
166
166
  ${e.actionTypes.map(t=>`export * from "./${t.apiName}";`).join(`
167
167
  `)}
168
168
  `));}function de(e){let r=Object.values(e.parameters).flatMap(({dataType:t})=>{let a=U(t);return a?[a]:[]});return [...e.operations.flatMap(t=>{switch(t.type){case"createObject":return [t.objectTypeApiName];case"modifyObject":return [t.objectTypeApiName];case"deleteObject":case"createLink":case"deleteLink":return []}}),...r]}function U(e){switch(e.type){case"objectSet":case"object":return e.objectTypeApiName;case"array":return U(e.subType);case"string":case"boolean":case"attachment":case"date":case"double":case"integer":case"long":case"timestamp":return}}function G(e){switch(e.dataType.type){case"integer":case"double":case"string":case"boolean":case"attachment":case"byte":case"decimal":case"float":case"geopoint":case"geoshape":case"long":case"short":return e.dataType.type;case"date":return "datetime";case"timestamp":return "timestamp";case"timeseries":case"array":throw new Error(`Type not supported for primaryKey: ${e.dataType.type}`);default:e.dataType;throw new Error(`Unknown type encountered for primaryKey: ${e.dataType}`)}}function z(e){switch(e.dataType.type){case"integer":case"string":case"byte":case"decimal":case"double":case"float":case"long":case"short":case"boolean":case"date":case"attachment":case"geopoint":case"geoshape":case"timestamp":case"timeseries":return {multiplicity:!1,description:e.description,type:k(e.dataType),nullable:!0};case"array":return {multiplicity:!0,description:e.description,type:k(e.dataType),nullable:!0};default:e.dataType;throw new Error(`Unexpected data type ${JSON.stringify(e.dataType)}`)}}function k(e){switch(e.type){case"integer":case"string":case"byte":case"decimal":case"double":case"float":case"long":case"short":case"boolean":case"attachment":case"geopoint":case"geoshape":case"timestamp":return e.type;case"date":return "datetime";case"array":return k(e.subType);case"timeseries":return e.itemType.type==="string"?"stringTimeseries":"numericTimeseries";default:throw new Error(`Unexecpected data type ${e}`)}}function O(e,r=[]){return {apiName:e.apiName,description:e.description,primaryKeyType:G(e.properties[e.primaryKey]),links:Object.fromEntries(r.map(o=>[o.apiName,{multiplicity:o.cardinality==="MANY",targetType:o.objectTypeApiName}])),properties:Object.fromEntries(Object.entries(e.properties).map(([o,t])=>[o,z(t)]))}}var ge=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","implements","interface","let","package","private","protected","public","static","yield"]);function B(e){return ge.has(e)}function W(e,r=[]){let o=new Set(r.map(t=>t.objectTypeApiName).filter(t=>t!==e.apiName));return `import type { OntologyObject, LocalDate, Timestamp, GeoShape, GeoPoint, Attachment, TimeSeries, MultiLink, SingleLink } from "@osdk/legacy-client";
@@ -209,7 +209,7 @@ ${r.flatMap(t=>[`readonly ${t.apiName}: ${t.cardinality==="MANY"?"MultiLink":"Si
209
209
  ${a.join(`
210
210
  `)}
211
211
  }
212
- `));}function g(e,r){switch(e.type){case"boolean":return "boolean";case"string":return "string";case"double":case"float":case"integer":case"long":return "number";case"date":return "LocalDate";case"timestamp":return "Timestamp";case"attachment":return "Attachment";case"array":return `Array<${g(e.subType,r)}>`;case"object":{let a=e.objectTypeApiName;return r.add(a),a}case"objectSet":{let a=e.objectTypeApiName;return r.add(a),`ObjectSet<${a}>`}case"set":return `Set<${g(e.subType,r)}>`;case"struct":return `{ ${e.fields.map(a=>{let n=d(a.fieldType);return `${a.name}${n?"?":""}: ${g(a.fieldType,r)}`}).join(`,
212
+ `));}function g(e,r){switch(e.type){case"boolean":return "boolean";case"string":return "string";case"double":case"float":case"integer":case"long":return "number";case"date":return "LocalDate";case"timestamp":return "Timestamp";case"attachment":return "Attachment";case"array":return `Array<${g(e.subType,r)}>`;case"object":{let a=e.objectTypeApiName;return r.add(a),`${a} | ${a}["__primaryKey"]`}case"objectSet":{let a=e.objectTypeApiName;return r.add(a),`ObjectSet<${a}>`}case"set":return `Set<${g(e.subType,r)}>`;case"struct":return `{ ${e.fields.map(a=>{let n=d(a.fieldType);return `${a.name}${n?"?":""}: ${g(a.fieldType,r)}`}).join(`,
213
213
  `)} }`;case"union":return e.unionTypes.map(a=>g(a,r)).filter(a=>a!=="null").join("|");case"twoDimensionalAggregation":return e.valueType,`TwoDimensionalAggregation<
214
214
  ${x(e.keyType)},
215
215
  ${re(e.valueType)}
@@ -217,7 +217,7 @@ ${r.flatMap(t=>[`readonly ${t.apiName}: ${t.cardinality==="MANY"?"MultiLink":"Si
217
217
  ${x(e.keyType)},
218
218
  ${x(e.valueType.keyType)},
219
219
  ${re(e.valueType.valueType)}
220
- >`;case"null":return "null";case"unsupported":throw new Error("Cannot generate queries for unsupported type");default:throw new Error(`Cannot generate queries for type ${e.type}`)}}function x(e){switch(e.type){case"boolean":return "boolean";case"double":case"integer":return "number";case"string":return "string";case"date":return "LocalDate";case"timestamp":return "Timestamp";case"range":return `Range<${$e(e.subType)}>`;default:throw new Error(`Unknown TwoDimensionalAggregation keyType ${e.type}`)}}function $e(e){switch(e.type){case"date":return "LocalDate";case"double":case"integer":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported QueryAggregationRangeSubType ${e.type}`)}}function re(e){switch(e.type){case"date":return "LocalDate";case"double":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported QueryAggregationValueType ${e.type}`)}}function oe(e){return e.replace(/\s/g,"")}async function he(e,r,o){let t=j.join(o,"ontology","objects"),a=j.join(o,"ontology","actions"),n=j.join(o,"ontology","queries"),s=F(e);await v(r,o),await I(s,r,o),await M(r,j.join(o,"ontology")),await L(s,r,t),await Z(s,r,t),await Q(s,r,a),await K(s,r,a),await ae(s,r,n),await te(s,r,n),await C(r,o);}function ne(e){return `
220
+ >`;case"null":return "null";case"unsupported":throw new Error("Cannot generate queries for unsupported type");default:throw new Error(`Cannot generate queries for type ${e.type}`)}}function x(e){switch(e.type){case"boolean":return "boolean";case"double":case"integer":return "number";case"string":return "string";case"date":return "LocalDate";case"timestamp":return "Timestamp";case"range":return `Range<${we(e.subType)}>`;default:throw new Error(`Unknown TwoDimensionalAggregation keyType ${e.type}`)}}function we(e){switch(e.type){case"date":return "LocalDate";case"double":case"integer":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported QueryAggregationRangeSubType ${e.type}`)}}function re(e){switch(e.type){case"date":return "LocalDate";case"double":return "number";case"timestamp":return "Timestamp";default:throw new Error(`Unsupported QueryAggregationValueType ${e.type}`)}}function oe(e){return e.replace(/\s/g,"")}async function he(e,r,o){let t=j.join(o,"ontology","objects"),a=j.join(o,"ontology","actions"),n=j.join(o,"ontology","queries"),s=F(e);await v(r,o),await I(s,r,o),await M(r,j.join(o,"ontology")),await L(s,r,t),await Z(s,r,t),await Q(s,r,a),await K(s,r,a),await ae(s,r,n),await te(s,r,n),await C(r,o);}function ne(e){return `
221
221
  export interface ${e.apiName} extends ObjectDefinition<"${e.apiName}", "${e.apiName}">{
222
222
  apiName: "${e.apiName}";
223
223
  properties: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/v1.1/generateClientSdkVersionOneDotOne.ts","../../src/shared/sanitizeMetadata.ts","../../src/v1.1/generateActions.ts","../../src/shared/getEditedEntities.ts","../../src/util/test/formatTs.ts","../../src/v1.1/generateFoundryClientFile.ts","../../src/v1.1/generateIndexFile.ts","../../src/v1.1/generateMetadataFile.ts","../../src/util/commaSeparatedIdentifiers.ts","../../src/util/commaSeparatedTypeIdentifiers.ts","../../src/v1.1/generateObjectsInterfaceFile.ts","../../src/v1.1/generateOntologyIndexFile.ts","../../src/v1.1/generatePerActionDataFiles.ts","../../src/shared/wireActionTypeV2ToSdkActionDefinition.ts","../../src/v1.1/generatePerObjectInterfaceAndDataFiles.ts","../../src/shared/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/shared/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/shared/wireObjectTypeV2ToSdkObjectDefinition.ts","../../src/util/reservedKeywords.ts","../../src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts","../../src/v1.1/generatePerQueryDataFiles.ts","../../src/shared/isNullableQueryDataType.ts","../../src/shared/wireQueryDataTypeToQueryDataTypeDefinition.ts","../../src/shared/wireQueryTypeV2ToSdkQueryDefinition.ts","../../src/v1.1/generateQueries.ts","../../src/v2.0/generateClientSdkVersionTwoPointZero.ts","../../src/v2.0/wireObjectTypeV2ToObjectDefinitionInterfaceString.ts"],"names":["path","sanitizeMetadata","ontology","actionType","camelize","name","segment","getModifiedEntityTypes","action","addedObjects","modifiedObjects","operation","_","format","organizeImports","formatTs","contents","generateActions","fs","outDir","importedObjects","actionSignatures","entries","modifiedEntityTypes","jsDocBlock","parameterBlock","parameterName","parameterData","typeScriptType","getTypeScriptTypeFromDataType","importedObject","actionParameter","objectType","generateFoundryClientFile","generateIndexFile","commaSeparatedIdentifiers","identifiers","alternateNames","i","alt","commaSeparatedTypeIdentifiers","altNames","generateMetadataFile","objectNames","actionNames","queryNames","query","actionAltNames","queryAltNames","seenIdentifiers","actionName","queryName","getImportClause","n","queryType","generateObjectsInterfaceFile","apiName","generateOntologyIndexFile","wireActionTypeV2ToSdkActionDefinition","input","key","value","wireActionParameterV2ToSdkParameterDefinition","createModifiedEntities","actionPropertyToSdkPropertyDefinition","parameterType","entities","generatePerActionDataFiles","uniqueApiNames","extractReferencedObjectsFromAction","referencedObjectsInParameters","dataType","objectTypeReference","extractReferencedObjectsFromActionParameter","wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","objectPropertyTypeToSdkPropertyDefinition","propertyType","wireObjectTypeV2ToSdkObjectDefinition","linkTypes","linkType","reservedKeywords","isReservedKeyword","wireObjectTypeV2ToObjectInterfaceStringV1","uniqueLinkTargets","a","linkTarget","getDescriptionIfPresent","wirePropertyTypeV2ToTypeScriptType","propertyName","propertyDefinition","property","description","generatePerObjectInterfaceAndDataFiles","object","links","isNullableQueryDataType","t","wireQueryDataTypeToQueryDataTypeDefinition","allowNulls","nonnull","acc","f","get2DQueryAggregationProps","get3DQueryAggregationProps","guardInvalidKeyTypes","wireQueryTypeV2ToSdkQueryDefinition","parameter","wireQueryParameterV2ToQueryParameterDefinition","generatePerQueryDataFiles","objectTypes","getObjectTypesFromQuery","types","getObjectTypesFromDataType","prop","type","generateQueries","signatures","outputType","handleQueryDataType","paramEntries","nullable","sanitizeDocTypeName","param","field","isNullable","aggregationKeyToTypescriptType","aggregationValueToTypescriptType","keyType","aggregationRangeToTypescriptType","subType","valueType","generateClientSdkVersionOneDotOne","objectsDir","actionsDir","queriesDir","sanitizedOntology","wireObjectTypeV2ToObjectDefinitionInterfaceString","generateClientSdkVersionTwoPointZero","obj"],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C,EAAM,SAAS,IAAI;AAAA,0BACZA,EAAM,aAAeD,CAAG;AAAA;AAAA;AAAA,SAGzC,CAAC;AAAA;AAAA;AAAA,GAIV,CDdA,eAAsB8E,GAAqCxI,EAAUgB,EAAIC,EAAQ,CAC/ED,EAAG,UAAUlB,EAAK,KAAKmB,EAAQ,UAAU,EAAG,MAAMJ,EAAS;AAAA;AAAA,KAExD,CAAC,EACJ,IAAM4B,EAAc,OAAO,KAAKzC,EAAS,WAAW,EACpDgB,EAAG,UAAUlB,EAAK,KAAKmB,EAAQ,aAAa,EAAG,MAAMJ,EAAS;AAAA;AAAA,QAExD4B,EAAY,IAAItC,GAAQ,WAAWA,CAAI,qBAAqBA,CAAI,IAAI,EAAE,KAAK;AAAA,CAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAO5EsC,EAAY,IAAItC,GAAQ,GAAGA,CAAI,KAAKA,CAAI,GAAG,EAAE,KAAK;AAAA,CAAI,CAAC;AAAA;AAAA,uCAE5BsC,EAAY,IAAIU,GAAK,IAAIA,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC;AAAA,KAC1E,CAAC,EACJ,QAAWhD,KAAQsC,EAAa,CAC9B,IAAMgG,EAAMzI,EAAS,YAAYG,CAAI,EACrCa,EAAG,UAAUlB,EAAK,KAAKmB,EAAQ,UAAW,GAAGd,CAAI,KAAK,EAAG,MAAMU,EAAS;AAAA;AAAA;AAAA;AAAA,qBAIvDV,CAAI,OAAO,KAAK,UAAUyE,EAAsC6D,CAAG,EAAG,KAAM,CAAC,CAAC,cAActI,CAAI;AAAA;AAAA,QAE7GoI,GAAkDE,CAAG,CAAC;AAAA,KACzD,CAAC,CACJ,CACF","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 */\n\nimport * as path from \"node:path\";\nimport { sanitizeMetadata } from \"../shared/sanitizeMetadata\";\nimport { generateActions } from \"./generateActions\";\nimport { generateFoundryClientFile } from \"./generateFoundryClientFile\";\nimport { generateIndexFile } from \"./generateIndexFile\";\nimport { generateMetadataFile } from \"./generateMetadataFile\";\nimport { generateObjectsInterfaceFile } from \"./generateObjectsInterfaceFile\";\nimport { generateOntologyIndexFile } from \"./generateOntologyIndexFile\";\nimport { generatePerActionDataFiles } from \"./generatePerActionDataFiles\";\nimport { generatePerObjectInterfaceAndDataFiles } from \"./generatePerObjectInterfaceAndDataFiles\";\nimport { generatePerQueryDataFiles } from \"./generatePerQueryDataFiles\";\nimport { generateQueries } from \"./generateQueries\";\nexport async function generateClientSdkVersionOneDotOne(ontology, fs, outDir) {\n const objectsDir = path.join(outDir, \"ontology\", \"objects\");\n const actionsDir = path.join(outDir, \"ontology\", \"actions\");\n const queriesDir = path.join(outDir, \"ontology\", \"queries\");\n const sanitizedOntology = sanitizeMetadata(ontology);\n await generateFoundryClientFile(fs, outDir);\n await generateMetadataFile(sanitizedOntology, fs, outDir);\n await generateOntologyIndexFile(fs, path.join(outDir, \"ontology\"));\n await generateObjectsInterfaceFile(sanitizedOntology, fs, objectsDir);\n await generatePerObjectInterfaceAndDataFiles(sanitizedOntology, fs, objectsDir);\n await generateActions(sanitizedOntology, fs, actionsDir);\n await generatePerActionDataFiles(sanitizedOntology, fs, actionsDir);\n await generateQueries(sanitizedOntology, fs, queriesDir);\n await generatePerQueryDataFiles(sanitizedOntology, fs, queriesDir);\n await generateIndexFile(fs, outDir);\n}","/*\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 */\n\nexport function sanitizeMetadata(ontology) {\n return {\n ...ontology,\n actionTypes: ontology.actionTypes.map(actionType => {\n return {\n ...actionType,\n apiName: camelize(actionType.apiName)\n };\n })\n };\n}\nfunction camelize(name) {\n return name.replace(/-./g, segment => segment[1].toUpperCase());\n}","/*\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 */\n\nimport path from \"path\";\nimport { getModifiedEntityTypes } from \"../shared/getEditedEntities\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateActions(ontology, fs, outDir) {\n const importedObjects = new Set();\n let actionSignatures = [];\n for (const action of ontology.actionTypes) {\n const entries = Object.entries(action.parameters);\n const modifiedEntityTypes = getModifiedEntityTypes(action);\n const addedObjects = Array.from(modifiedEntityTypes.addedObjects);\n const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);\n addedObjects.forEach(importedObjects.add, importedObjects);\n modifiedObjects.forEach(importedObjects.add, importedObjects);\n let jsDocBlock = [\"/**\"];\n if (action.description) {\n jsDocBlock.push(`* ${action.description}`);\n }\n let parameterBlock = \"\";\n if (entries.length > 0) {\n parameterBlock = `params: { \\n`;\n for (const [parameterName, parameterData] of entries) {\n parameterBlock += `\"${parameterName}\"`;\n parameterBlock += parameterData.required ? \": \" : \"?: \";\n const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);\n parameterBlock += `${typeScriptType};\\n`;\n jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);\n }\n parameterBlock += \"}, \";\n }\n jsDocBlock.push(`*/`);\n actionSignatures.push(`\n ${jsDocBlock.join(\"\\n\")}\n ${action.apiName}<O extends ActionExecutionOptions>(${parameterBlock}options?: O): \n Promise<Result<ActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(\" | \") : \"void\"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(\" | \") : \"void\"}>>, ActionError>>;`);\n }\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Actions.ts\"), await formatTs(`\n import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, ActionError, Result, ActionResponseFromOptions } from \"@osdk/legacy-client\";\n ${Array.from(importedObjects).map(importedObject => `import type { ${importedObject} } from \"../objects/${importedObject}\";`).join(\"\\n\")}\n export interface Actions {\n ${actionSignatures.join(\"\\n\")}\n }\n `));\n}\nfunction getTypeScriptTypeFromDataType(actionParameter, importedObjects) {\n switch (actionParameter.type) {\n case \"objectSet\":\n {\n const objectType = actionParameter.objectTypeApiName;\n importedObjects.add(objectType);\n return `ObjectSet<${objectType}>`;\n }\n case \"object\":\n {\n const objectType = actionParameter.objectTypeApiName;\n importedObjects.add(objectType);\n return `${objectType}`;\n }\n case \"array\":\n return `Array<${getTypeScriptTypeFromDataType(actionParameter.subType, importedObjects)}>`;\n case \"string\":\n return `string`;\n case \"boolean\":\n return `boolean`;\n case \"attachment\":\n return `Attachment`;\n case \"date\":\n return `LocalDate`;\n case \"double\":\n case \"integer\":\n case \"long\":\n return `number`;\n case \"timestamp\":\n return `Timestamp`;\n default:\n const _ = actionParameter;\n throw new Error(`Unsupported action parameter type: ${actionParameter}`);\n }\n}","/*\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 */\n\nexport function getModifiedEntityTypes(action) {\n const addedObjects = new Set();\n const modifiedObjects = new Set();\n for (const operation of action.operations) {\n switch (operation.type) {\n case \"createObject\":\n addedObjects.add(operation.objectTypeApiName);\n break;\n case \"modifyObject\":\n modifiedObjects.add(operation.objectTypeApiName);\n break;\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n break;\n default:\n const _ = operation;\n }\n }\n return {\n addedObjects,\n modifiedObjects\n };\n}","/*\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 */\n\nimport { format } from \"prettier\";\n// @ts-ignore the plugin doesn't have types but we need to import the actual plugin\n// so we can bundle it rather than trying to resolve it at runtime\nimport organizeImports from \"prettier-plugin-organize-imports\";\nexport function formatTs(contents) {\n return format(contents, {\n parser: \"typescript\",\n singleQuote: true,\n trailingComma: \"all\",\n plugins: [organizeImports],\n tabWidth: 2,\n printWidth: 120\n });\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateFoundryClientFile(fs, outDir) {\n await fs.writeFile(path.join(outDir, \"FoundryClient.ts\"), await formatTs(`\n import { BaseFoundryClient } from \"@osdk/legacy-client\";\n import type { Auth, FoundryClientOptions } from \"@osdk/legacy-client\";\n import { Ontology } from \"./Ontology\";\n\n export class FoundryClient<TAuth extends Auth = Auth> extends BaseFoundryClient<typeof Ontology, TAuth> {\n constructor(options: FoundryClientOptions<TAuth>) {\n super(options, Ontology);\n }\n\n get ontology(): Ontology {\n return super.ontology;\n }\n }`));\n}","/*\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 */\n\nimport * as path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateIndexFile(fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export {\n ActionExecutionMode,\n ActionResponse,\n ActionValidationResult, \n ArrayType,\n AttachmentType,\n BooleanType,\n ByteType,\n DateType,\n DecimalType,\n DoubleType,\n FloatType,\n FoundryApiError,\n GeoPoint,\n GeoPointType,\n GeoShape,\n GeoShapeType,\n IntegerType,\n isErr,\n isOk, \n LocalDate,\n LongType,\n ObjectType,\n Op,\n Polygon,\n ReturnEditsMode,\n SetType,\n ShortType,\n StringType,\n StructField,\n StructType,\n TimeSeriesType,\n Timestamp,\n TimestampType,\n visitError,\n PublicClientAuth,\n ConfidentialClientAuth,\n UserTokenAuth\n } from '@osdk/legacy-client';\n export type {\n ActionError,\n AggregateObjectsError,\n AggregationGroup,\n AggregationResult, \n Attachment,\n AttachmentMetadata, \n AttachmentsError,\n Edits,\n ErrorVisitor,\n GetLinkedObjectError,\n GetObjectError,\n ListLinkedObjectsError,\n ListObjectsError,\n LoadObjectSetError,\n Page,\n PermissionDenied,\n QueryError,\n QueryResponse, \n Result,\n SearchObjectsError,\n TimeSeries,\n TimeSeriesError,\n TimeSeriesPoint, \n Unauthorized,\n UnknownError, \n } from '@osdk/legacy-client';\n export { Ontology } from \"./Ontology\";\n export { FoundryClient } from \"./FoundryClient\";\n `));\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { commaSeparatedIdentifiers } from \"../util/commaSeparatedIdentifiers\";\nimport { commaSeparatedTypeIdentifiers } from \"../util/commaSeparatedTypeIdentifiers\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateMetadataFile(ontology, fs, outDir) {\n const objectNames = Object.keys(ontology.objectTypes);\n const actionNames = ontology.actionTypes.map(action => action.apiName);\n const queryNames = ontology.queryTypes.map(query => query.apiName);\n const actionAltNames = new Map();\n const queryAltNames = new Map();\n const seenIdentifiers = new Set(objectNames);\n for (const actionName of actionNames) {\n if (seenIdentifiers.has(actionName)) {\n actionAltNames.set(actionName, `${actionName}Action`);\n } else {\n seenIdentifiers.add(actionName);\n }\n }\n for (const queryName of queryNames) {\n if (seenIdentifiers.has(queryName)) {\n queryAltNames.set(queryName, `${queryName}Query`);\n }\n }\n const getImportClause = (name, altNames) => {\n const alt = altNames.get(name);\n if (alt) {\n return `${name} as ${alt}`;\n } else {\n return name;\n }\n };\n await fs.writeFile(path.join(outDir, \"Ontology.ts\"), await formatTs(`\n import type { OntologyDefinition } from \"@osdk/api\";\n import type { Ontology as ClientOntology } from \"@osdk/legacy-client\";\n import type { Objects } from \"./ontology/objects/Objects\";\n import type { Actions } from \"./ontology/actions/Actions\";\n import type { Queries } from \"./ontology/queries/Queries\";\n ${objectNames.map(name => `import {${name}} from \"./ontology/objects/${name}\";`).join(\"\\n\")}\n ${actionNames.map(name => `import {${getImportClause(name, actionAltNames)}} from \"./ontology/actions/${name}\";`).join(\"\\n\")}\n ${queryNames.map(name => `import {${getImportClause(name, queryAltNames)}} from \"./ontology/queries/${name}\";`).join(\"\\n\")}\n\n export const Ontology : {\n metadata: {\n ontologyRid: \"${ontology.rid}\",\n ontologyApiName: \"${ontology.apiName}\",\n userAgent: \"foundry-typescript-osdk/0.0.1\",\n },\n objects: {\n ${commaSeparatedTypeIdentifiers(objectNames)}\n },\n actions: {\n ${commaSeparatedTypeIdentifiers(actionNames, actionAltNames)}\n },\n queries: {\n ${commaSeparatedTypeIdentifiers(queryNames, queryAltNames)}\n },\n } = {\n metadata: {\n ontologyRid: \"${ontology.rid}\" as const,\n ontologyApiName: \"${ontology.apiName}\" as const,\n userAgent: \"foundry-typescript-osdk/0.0.1\" as const,\n },\n objects: {\n ${commaSeparatedIdentifiers(objectNames)}\n },\n actions: {\n ${commaSeparatedIdentifiers(actionNames, actionAltNames)}\n },\n queries: {\n ${commaSeparatedIdentifiers(queryNames, queryAltNames)}\n }\n } satisfies OntologyDefinition<${objectNames.map(n => `\"${n}\"`).join(\"|\")}, ${ontology.actionTypes.map(actionType => `\"${actionType.apiName}\"`).join(\"|\")}, ${ontology.queryTypes.map(queryType => `\"${queryType.apiName}\"`).join(\"|\")}>;\n \nexport interface Ontology extends ClientOntology<typeof Ontology> {\n objects: Objects;\n actions: Actions;\n queries: Queries;\n}`));\n}","/*\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 */\n\nexport function commaSeparatedIdentifiers(identifiers, alternateNames) {\n return identifiers.map(i => {\n const alt = alternateNames?.get(i);\n if (alt) {\n return `${i}: ${alt}`;\n }\n return i;\n }).join(\",\");\n}","/*\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 */\n\nexport function commaSeparatedTypeIdentifiers(identifiers, altNames) {\n return identifiers.map(i => `${i}: typeof ${altNames?.get(i) ?? i}`).join(\",\");\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateObjectsInterfaceFile(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Objects.ts\"), await formatTs(`\n import { BaseObjectSet } from \"@osdk/legacy-client\";\n ${Array.from(Object.keys(ontology.objectTypes)).map(importedObject => `import type { ${importedObject} } from \"./${importedObject}\";`).join(\"\\n\")}\n \n export interface Objects {\n ${Object.keys(ontology.objectTypes).map(apiName => `${apiName} : BaseObjectSet<${apiName}>;`).join(\"\\n\")}\n }\n ;`));\n}","/*\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 */\n\nimport * as path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateOntologyIndexFile(fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export type { ObjectSet } from \"@osdk/legacy-client\";\n `));\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireActionTypeV2ToSdkActionDefinition } from \"../shared/wireActionTypeV2ToSdkActionDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generatePerActionDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(ontology.actionTypes.map(async action => {\n const uniqueApiNames = new Set(extractReferencedObjectsFromAction(action));\n await fs.writeFile(path.join(outDir, `${action.apiName}.ts`), await formatTs(`\n import { ActionDefinition } from \"@osdk/api\";\n \n export const ${action.apiName} = ${JSON.stringify(wireActionTypeV2ToSdkActionDefinition(action), null, 2)} satisfies ActionDefinition<\"${action.apiName}\", ${uniqueApiNames.size > 0 ? [...uniqueApiNames].map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, `index.ts`), await formatTs(`\n ${ontology.actionTypes.map(action => `export * from \"./${action.apiName}\";`).join(\"\\n\")}\n `));\n}\nfunction extractReferencedObjectsFromAction(actionType) {\n const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({\n dataType\n }) => {\n const objectTypeReference = extractReferencedObjectsFromActionParameter(dataType);\n return objectTypeReference ? [objectTypeReference] : [];\n });\n const referenceObjectsInEdits = actionType.operations.flatMap(value => {\n switch (value.type) {\n case \"createObject\":\n return [value.objectTypeApiName];\n case \"modifyObject\":\n return [value.objectTypeApiName];\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n return [];\n }\n });\n return [...referenceObjectsInEdits, ...referencedObjectsInParameters];\n}\nfunction extractReferencedObjectsFromActionParameter(actionParameter) {\n switch (actionParameter.type) {\n case \"objectSet\":\n case \"object\":\n return actionParameter.objectTypeApiName;\n case \"array\":\n return extractReferencedObjectsFromActionParameter(actionParameter.subType);\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"date\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"timestamp\":\n return undefined;\n }\n}","/*\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 */\n\nimport { getModifiedEntityTypes } from \"./getEditedEntities\";\nexport function wireActionTypeV2ToSdkActionDefinition(input) {\n const modifiedEntityTypes = getModifiedEntityTypes(input);\n return {\n apiName: input.apiName,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([key, value]) => [key, wireActionParameterV2ToSdkParameterDefinition(value)])),\n displayName: input.displayName,\n description: input.description,\n modifiedEntities: createModifiedEntities(modifiedEntityTypes.addedObjects, modifiedEntityTypes.modifiedObjects)\n };\n}\nfunction wireActionParameterV2ToSdkParameterDefinition(value) {\n switch (value.dataType.type) {\n case \"string\":\n case \"boolean\":\n case \"object\":\n case \"attachment\":\n case \"date\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"objectSet\":\n case \"timestamp\":\n return {\n multiplicity: false,\n type: actionPropertyToSdkPropertyDefinition(value.dataType),\n nullable: value.required ? false : true,\n description: value.description\n };\n case \"array\":\n return {\n multiplicity: true,\n type: actionPropertyToSdkPropertyDefinition(value.dataType),\n nullable: value.required ? false : true,\n description: value.description\n };\n }\n}\nfunction actionPropertyToSdkPropertyDefinition(parameterType) {\n switch (parameterType.type) {\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"timestamp\":\n return parameterType.type;\n case \"date\":\n return \"datetime\";\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: parameterType.objectTypeApiName\n };\n case \"object\":\n return {\n type: \"object\",\n object: parameterType.objectTypeApiName\n };\n case \"array\":\n return actionPropertyToSdkPropertyDefinition(parameterType.subType);\n }\n}\nfunction createModifiedEntities(addedObjects, modifiedObjects) {\n let entities = {};\n for (const key of addedObjects) {\n entities[key] = {\n created: true,\n modified: false\n };\n }\n for (const key of modifiedObjects) {\n if (entities[key]) {\n entities[key].modified = true;\n } else {\n entities[key] = {\n created: false,\n modified: true\n };\n }\n }\n return entities;\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireObjectTypeV2ToSdkObjectDefinition } from \"../shared/wireObjectTypeV2ToSdkObjectDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nimport { wireObjectTypeV2ToObjectInterfaceStringV1 } from \"./wireObjectTypeV2ToV1ObjectInterfaceString\";\nexport async function generatePerObjectInterfaceAndDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(Object.values(ontology.objectTypes).map(async object => {\n const links = ontology.linkTypes[object.apiName];\n const uniqueApiNames = new Set(links?.map(a => a.objectTypeApiName));\n await fs.writeFile(path.join(outDir, `${object.apiName}.ts`), await formatTs(`\n import { ObjectDefinition } from \"@osdk/api\";\n ${wireObjectTypeV2ToObjectInterfaceStringV1(object, links)}\n\n export const ${object.apiName} = ${JSON.stringify(wireObjectTypeV2ToSdkObjectDefinition(object, links), null, 2)} satisfies ObjectDefinition<\"${object.apiName}\", ${uniqueApiNames.size > 0 ? [...uniqueApiNames].map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n ${Object.keys(ontology.objectTypes).map(apiName => `export * from \"./${apiName}\";`).join(\"\\n\")}\n export type { ObjectSet } from \"@osdk/legacy-client\";\\n\n `));\n}","/*\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 */\n\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"byte\":\n case \"decimal\":\n case \"float\":\n case \"geopoint\":\n case \"geoshape\":\n case \"long\":\n case \"short\":\n {\n return input.dataType.type;\n }\n case \"date\":\n {\n return \"datetime\";\n }\n case \"timestamp\":\n {\n return \"timestamp\";\n }\n case \"timeseries\":\n case \"array\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}","/*\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 */\n\nexport function wirePropertyV2ToSdkPropertyDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"date\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n return {\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n case \"array\":\n {\n return {\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n }\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\n switch (propertyType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n return propertyType.type;\n case \"date\":\n return \"datetime\";\n case \"array\":\n return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);\n case \"timeseries\":\n if (propertyType.itemType.type === \"string\") {\n return \"stringTimeseries\";\n }\n return \"numericTimeseries\";\n default:\n const _ = propertyType;\n throw new Error(`Unexecpected data type ${propertyType}`);\n }\n}","/*\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 */\n\nimport { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition\";\nexport function wireObjectTypeV2ToSdkObjectDefinition(input, linkTypes = []) {\n return {\n apiName: input.apiName,\n description: input.description,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input.properties[input.primaryKey]),\n links: Object.fromEntries(linkTypes.map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName\n }];\n })),\n properties: Object.fromEntries(Object.entries(input.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value)]))\n };\n}","/*\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 */\n\n// This must match the reservedKeywords definition in packages/legacy-client\nconst reservedKeywords = new Set([\"break\", \"case\", \"catch\", \"class\", \"const\", \"continue\", \"debugger\", \"default\", \"delete\", \"do\", \"else\", \"enum\", \"export\", \"extends\", \"false\", \"finally\", \"for\", \"function\", \"if\", \"import\", \"in\", \"instanceof\", \"new\", \"null\", \"return\", \"super\", \"switch\", \"this\", \"throw\", \"true\", \"try\", \"typeof\", \"var\", \"void\", \"while\", \"with\", \"implements\", \"interface\", \"let\", \"package\", \"private\", \"protected\", \"public\", \"static\", \"yield\"]);\nexport function isReservedKeyword(name) {\n return reservedKeywords.has(name);\n}","/*\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 */\n\nimport { isReservedKeyword } from \"../util/reservedKeywords\";\nexport function wireObjectTypeV2ToObjectInterfaceStringV1(input, linkTypes = []) {\n const uniqueLinkTargets = new Set(linkTypes.map(a => a.objectTypeApiName).filter(a => a !== input.apiName));\n return `import type { OntologyObject, LocalDate, Timestamp, GeoShape, GeoPoint, Attachment, TimeSeries, MultiLink, SingleLink } from \"@osdk/legacy-client\";\n${Array.from(uniqueLinkTargets).map(linkTarget => `import type { ${linkTarget} } from \"./${linkTarget}\";`).join(\"\\n\")}\n\n ${getDescriptionIfPresent(input.description)}export interface ${input.apiName} extends OntologyObject {\n readonly __apiName: \"${input.apiName}\";\n readonly __primaryKey: ${wirePropertyTypeV2ToTypeScriptType(input.properties[input.primaryKey].dataType)};\n${Object.entries(input.properties).flatMap(([propertyName, propertyDefinition]) => {\n const propertyType = wirePropertyTypeV2ToTypeScriptType(propertyDefinition.dataType);\n const entries = [`${getDescriptionIfPresent(propertyDefinition.description)}readonly ${propertyName}: ${propertyType} | undefined`];\n if (isReservedKeyword(propertyName)) {\n entries.push(`/** @deprecated please migrate to '${propertyName}' instead */\n readonly ${propertyName}_: ${propertyType} | undefined`);\n }\n return entries;\n }).join(\";\\n\")}\n${linkTypes.flatMap(linkType => {\n const entries = [`readonly ${linkType.apiName}: ${linkType.cardinality === \"MANY\" ? \"MultiLink\" : \"SingleLink\"}<${linkType.objectTypeApiName}>`];\n return entries;\n }).join(\";\\n\")}\n}\n `;\n}\nfunction wirePropertyTypeV2ToTypeScriptType(property) {\n switch (property.type) {\n case \"string\":\n return \"string\";\n case \"boolean\":\n return \"boolean\";\n case \"array\":\n return wirePropertyTypeV2ToTypeScriptType(property.subType) + \"[]\";\n case \"integer\":\n return \"number\";\n case \"attachment\":\n return \"Attachment\";\n case \"byte\":\n return \"number\";\n case \"date\":\n return \"LocalDate\";\n case \"decimal\":\n return \"number\";\n case \"double\":\n return \"number\";\n case \"float\":\n return \"number\";\n case \"geopoint\":\n return \"GeoPoint\";\n case \"geoshape\":\n return \"GeoShape\";\n case \"long\":\n return \"number\";\n case \"short\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"timeseries\":\n return property.itemType.type === \"string\" ? `TimeSeries<string>` : `TimeSeries<number>`;\n default:\n const _ = property;\n throw new Error(`Unknown property type ${property}`);\n }\n}\nfunction getDescriptionIfPresent(description) {\n if (description) {\n return `/**\n * ${description}\n */\\n`;\n }\n return \"\";\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireQueryTypeV2ToSdkQueryDefinition } from \"../shared/wireQueryTypeV2ToSdkQueryDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generatePerQueryDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(ontology.queryTypes.map(async query => {\n const objectTypes = getObjectTypesFromQuery(query);\n await fs.writeFile(path.join(outDir, `${query.apiName}.ts`), await formatTs(`\n import { QueryDefinition } from \"@osdk/api\";\n\n export const ${query.apiName} = ${JSON.stringify(wireQueryTypeV2ToSdkQueryDefinition(query))} satisfies QueryDefinition<\"${query.apiName}\", ${objectTypes.length > 0 ? objectTypes.map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n ${ontology.queryTypes.map(query => `export * from \"./${query.apiName}\";`).join(\"\\n\")}\n `));\n}\nfunction getObjectTypesFromQuery(query) {\n const types = new Set();\n for (const {\n dataType\n } of Object.values(query.parameters)) {\n getObjectTypesFromDataType(dataType, types);\n }\n getObjectTypesFromDataType(query.output, types);\n return Array.from(types);\n}\nfunction getObjectTypesFromDataType(dataType, types) {\n switch (dataType.type) {\n case \"array\":\n case \"set\":\n getObjectTypesFromDataType(dataType.subType, types);\n return;\n case \"object\":\n types.add(dataType.objectTypeApiName);\n return;\n case \"objectSet\":\n types.add(dataType.objectTypeApiName);\n return;\n case \"struct\":\n for (const prop of Object.values(dataType.fields)) {\n getObjectTypesFromDataType(prop.fieldType, types);\n }\n return;\n case \"union\":\n for (const type of dataType.unionTypes) {\n getObjectTypesFromDataType(type, types);\n }\n return;\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"null\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"unsupported\":\n /* complete no-op */\n return;\n default:\n const _ = dataType;\n throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);\n }\n}","/*\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 */\n\nexport function isNullableQueryDataType(input) {\n if (input.type === \"null\") {\n return true;\n }\n if (input.type === \"union\") {\n return input.unionTypes.some(t => isNullableQueryDataType(t));\n }\n return false;\n}","/*\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 */\n\nimport { isNullableQueryDataType } from \"./isNullableQueryDataType\";\nexport function wireQueryDataTypeToQueryDataTypeDefinition(input) {\n switch (input.type) {\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"string\":\n case \"timestamp\":\n return {\n type: input.type,\n nullable: false\n };\n case \"object\":\n return {\n type: {\n type: \"object\",\n object: input.objectTypeApiName\n },\n nullable: false\n };\n case \"objectSet\":\n return {\n type: {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName\n },\n nullable: false\n };\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true\n };\n case \"set\":\n return {\n type: {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType)\n },\n nullable: false\n };\n case \"union\":\n const allowNulls = isNullableQueryDataType(input);\n\n // special case for a union where one half is nullable to skip the union step and just allow nulls directly\n if (allowNulls && input.unionTypes.length === 2) {\n const nonnull = input.unionTypes.find(t => t.type !== null);\n if (nonnull) {\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(nonnull),\n nullable: true\n };\n }\n }\n return {\n type: {\n type: \"union\",\n union: input.unionTypes.reduce((acc, t) => {\n if (t.type === \"null\") {\n return acc;\n }\n acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));\n return acc;\n }, [])\n },\n nullable: allowNulls\n };\n case \"struct\":\n return {\n type: {\n type: \"struct\",\n struct: Object.fromEntries(input.fields.map(f => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)]))\n },\n nullable: false\n };\n case \"twoDimensionalAggregation\":\n return {\n type: {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input)\n }\n };\n case \"threeDimensionalAggregation\":\n return {\n type: {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input)\n }\n };\n case \"null\":\n case \"unsupported\":\n throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);\n default:\n const _ = input;\n throw new Error(`Unsupported QueryDataType.type ${input.type}`);\n }\n}\nfunction get2DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: input.valueType.type\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: input.valueType.type\n };\n }\n throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);\n }\n}\nfunction get3DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: get2DQueryAggregationProps(input.valueType)\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: get2DQueryAggregationProps(input.valueType)\n };\n }\n throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);\n }\n}\n\n/**\n * Guard against aggregation key types that are allowed by the backend types but are illegal to actually use\n */\nfunction guardInvalidKeyTypes(key) {\n return key.type === \"string\" || key.type === \"boolean\";\n}","/*\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 */\n\nimport { wireQueryDataTypeToQueryDataTypeDefinition } from \"./wireQueryDataTypeToQueryDataTypeDefinition\";\nexport function wireQueryTypeV2ToSdkQueryDefinition(input) {\n return {\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n rid: input.rid,\n version: input.version,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),\n output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)\n };\n}\nfunction wireQueryParameterV2ToQueryParameterDefinition(parameter) {\n return {\n description: parameter.description,\n dataType: wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)\n };\n}","/*\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 */\n\nimport path from \"path\";\nimport { isNullableQueryDataType } from \"../shared/isNullableQueryDataType\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateQueries(ontology, fs, outDir) {\n const importedObjects = new Set();\n const signatures = [];\n for (const query of ontology.queryTypes) {\n const jsDocBlock = [\"/**\"];\n if (query.description) {\n jsDocBlock.push(`* ${query.description}`);\n }\n const outputType = handleQueryDataType(query.output, importedObjects);\n const paramEntries = [];\n for (const [name, parameter] of Object.entries(query.parameters)) {\n const nullable = isNullableQueryDataType(parameter.dataType);\n const type = handleQueryDataType(parameter.dataType, importedObjects);\n paramEntries.push(`\"${name}\"${nullable ? \"?\" : \"\"}: ${type}`);\n jsDocBlock.push(`* @param {${sanitizeDocTypeName(type)}} params.${name}${parameter.description ? ` - ${parameter.description}` : \"\"}`);\n }\n const param = paramEntries.length === 0 ? \"\" : `params: { ${paramEntries.join(\"; \")} }`;\n jsDocBlock.push(`* @returns ${sanitizeDocTypeName(outputType)}`, \"*/\");\n signatures.push(`\n ${jsDocBlock.join(\"\\n\")}\n ${query.apiName}(${param}): Promise<Result<QueryResponse<${outputType}>, QueryError>>;\n `);\n }\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Queries.ts\"), await formatTs(`\n import type { QueryResponse, QueryError, Result, Timestamp, LocalDate, Range, Attachment, ObjectSet, TwoDimensionalAggregation, ThreeDimensionalAggregation } from \"@osdk/legacy-client\";\n ${Array.from(importedObjects).map(importedObject => `import type { ${importedObject} } from \"../objects/${importedObject}\";`).join(\"\\n\")}\n\n export interface Queries {\n ${signatures.join(\"\\n\")}\n }\n `));\n}\nfunction handleQueryDataType(dataType, importedObjects) {\n switch (dataType.type) {\n case \"boolean\":\n return \"boolean\";\n case \"string\":\n return \"string\";\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n return \"number\";\n case \"date\":\n return \"LocalDate\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"attachment\":\n return \"Attachment\";\n case \"array\":\n return `Array<${handleQueryDataType(dataType.subType, importedObjects)}>`;\n case \"object\":\n {\n const objectType = dataType.objectTypeApiName;\n importedObjects.add(objectType);\n return objectType;\n }\n case \"objectSet\":\n {\n const objectType = dataType.objectTypeApiName;\n importedObjects.add(objectType);\n return `ObjectSet<${objectType}>`;\n }\n case \"set\":\n return `Set<${handleQueryDataType(dataType.subType, importedObjects)}>`;\n case \"struct\":\n const properties = dataType.fields.map(field => {\n const isNullable = isNullableQueryDataType(field.fieldType);\n return `${field.name}${isNullable ? \"?\" : \"\"}: ${handleQueryDataType(field.fieldType, importedObjects)}`;\n });\n return `{ ${properties.join(\",\\n\")} }`;\n case \"union\":\n return dataType.unionTypes.map(type => handleQueryDataType(type, importedObjects)).filter(type => type !== \"null\").join(\"|\");\n case \"twoDimensionalAggregation\":\n dataType.valueType;\n return `TwoDimensionalAggregation<\n ${aggregationKeyToTypescriptType(dataType.keyType)},\n ${aggregationValueToTypescriptType(dataType.valueType)}\n >`;\n case \"threeDimensionalAggregation\":\n return `ThreeDimensionalAggregation<\n ${aggregationKeyToTypescriptType(dataType.keyType)},\n ${aggregationKeyToTypescriptType(dataType.valueType.keyType)},\n ${aggregationValueToTypescriptType(dataType.valueType.valueType)}\n >`;\n case \"null\":\n return \"null\";\n case \"unsupported\":\n throw new Error(\"Cannot generate queries for unsupported type\");\n default:\n const _ = dataType;\n throw new Error(`Cannot generate queries for type ${dataType.type}`);\n }\n}\nfunction aggregationKeyToTypescriptType(keyType) {\n switch (keyType.type) {\n case \"boolean\":\n return \"boolean\";\n case \"double\":\n case \"integer\":\n return \"number\";\n case \"string\":\n return \"string\";\n case \"date\":\n return \"LocalDate\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"range\":\n return `Range<${aggregationRangeToTypescriptType(keyType.subType)}>`;\n default:\n const _ = keyType;\n throw new Error(`Unknown TwoDimensionalAggregation keyType ${keyType.type}`);\n }\n}\nfunction aggregationRangeToTypescriptType(subType) {\n switch (subType.type) {\n case \"date\":\n return \"LocalDate\";\n case \"double\":\n case \"integer\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n default:\n const _ = subType;\n throw new Error(`Unsupported QueryAggregationRangeSubType ${subType.type}`);\n }\n}\nfunction aggregationValueToTypescriptType(valueType) {\n switch (valueType.type) {\n case \"date\":\n return \"LocalDate\";\n case \"double\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n default:\n const _ = valueType;\n throw new Error(`Unsupported QueryAggregationValueType ${valueType.type}`);\n }\n}\nfunction sanitizeDocTypeName(type) {\n return type.replace(/\\s/g, \"\");\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireObjectTypeV2ToSdkObjectDefinition } from \"../shared/wireObjectTypeV2ToSdkObjectDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nimport { wireObjectTypeV2ToObjectDefinitionInterfaceString } from \"./wireObjectTypeV2ToObjectDefinitionInterfaceString\";\nexport async function generateClientSdkVersionTwoPointZero(ontology, fs, outDir) {\n fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export { Ontology } from \"./Ontology\";\n `));\n const objectNames = Object.keys(ontology.objectTypes);\n fs.writeFile(path.join(outDir, \"Ontology.ts\"), await formatTs(`\n import type { OntologyDefinition } from \"@osdk/api\";\n ${objectNames.map(name => `import {${name}} from \"./objects/${name}\";`).join(\"\\n\")}\n ${/* FIXME: Generate this file */\"\"}\n import { OntologyMetadata } from \"./OntologyMetadata\";\n \n export const Ontology = {\n metadata: OntologyMetadata,\n objects: {\n ${objectNames.map(name => `${name}: ${name},`).join(\"\\n\")}\n },\n } satisfies OntologyDefinition<${objectNames.map(n => `\"${n}\"`).join(\"|\")}>;\n `));\n for (const name of objectNames) {\n const obj = ontology.objectTypes[name];\n fs.writeFile(path.join(outDir, `objects`, `${name}.ts`), await formatTs(`\n \n import type { ObjectDefinition } from \"@osdk/api\";\n\n export const ${name} = ${JSON.stringify(wireObjectTypeV2ToSdkObjectDefinition(obj), null, 2)} satisfies ${name};\n\n ${wireObjectTypeV2ToObjectDefinitionInterfaceString(obj)}\n `));\n }\n}","/*\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 */\n\nexport function wireObjectTypeV2ToObjectDefinitionInterfaceString(input) {\n return `\n export interface ${input.apiName} extends ObjectDefinition<\"${input.apiName}\", \"${input.apiName}\">{\n apiName: \"${input.apiName}\";\n properties: {\n ${Object.entries(input.properties).map(([key, value]) => `\n /**\n * ${value.description ?? \"\"}\n **/\n ${key}: {\n type: \"${value.dataType.type}\";\n displayName: \"${value.displayName ?? key}\";\n }\n \n `)}\n }\n }\n `;\n}"]}
1
+ {"version":3,"sources":["../../src/v1.1/generateClientSdkVersionOneDotOne.ts","../../src/shared/sanitizeMetadata.ts","../../src/v1.1/generateActions.ts","../../src/shared/getEditedEntities.ts","../../src/util/test/formatTs.ts","../../src/v1.1/generateFoundryClientFile.ts","../../src/v1.1/generateIndexFile.ts","../../src/v1.1/generateMetadataFile.ts","../../src/util/commaSeparatedIdentifiers.ts","../../src/util/commaSeparatedTypeIdentifiers.ts","../../src/v1.1/generateObjectsInterfaceFile.ts","../../src/v1.1/generateOntologyIndexFile.ts","../../src/v1.1/generatePerActionDataFiles.ts","../../src/shared/wireActionTypeV2ToSdkActionDefinition.ts","../../src/v1.1/generatePerObjectInterfaceAndDataFiles.ts","../../src/shared/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts","../../src/shared/wirePropertyV2ToSdkPropertyDefinition.ts","../../src/shared/wireObjectTypeV2ToSdkObjectDefinition.ts","../../src/util/reservedKeywords.ts","../../src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts","../../src/v1.1/generatePerQueryDataFiles.ts","../../src/shared/isNullableQueryDataType.ts","../../src/shared/wireQueryDataTypeToQueryDataTypeDefinition.ts","../../src/shared/wireQueryTypeV2ToSdkQueryDefinition.ts","../../src/v1.1/generateQueries.ts","../../src/v2.0/generateClientSdkVersionTwoPointZero.ts","../../src/v2.0/wireObjectTypeV2ToObjectDefinitionInterfaceString.ts"],"names":["path","sanitizeMetadata","ontology","actionType","camelize","name","segment","getModifiedEntityTypes","action","addedObjects","modifiedObjects","operation","_","format","organizeImports","formatTs","contents","generateActions","fs","outDir","importedObjects","actionSignatures","entries","modifiedEntityTypes","jsDocBlock","parameterBlock","parameterName","parameterData","typeScriptType","getTypeScriptTypeFromDataType","importedObject","actionParameter","objectType","generateFoundryClientFile","generateIndexFile","commaSeparatedIdentifiers","identifiers","alternateNames","i","alt","commaSeparatedTypeIdentifiers","altNames","generateMetadataFile","objectNames","actionNames","queryNames","query","actionAltNames","queryAltNames","seenIdentifiers","actionName","queryName","getImportClause","n","queryType","generateObjectsInterfaceFile","apiName","generateOntologyIndexFile","wireActionTypeV2ToSdkActionDefinition","input","key","value","wireActionParameterV2ToSdkParameterDefinition","createModifiedEntities","actionPropertyToSdkPropertyDefinition","parameterType","entities","generatePerActionDataFiles","uniqueApiNames","extractReferencedObjectsFromAction","referencedObjectsInParameters","dataType","objectTypeReference","extractReferencedObjectsFromActionParameter","wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","objectPropertyTypeToSdkPropertyDefinition","propertyType","wireObjectTypeV2ToSdkObjectDefinition","linkTypes","linkType","reservedKeywords","isReservedKeyword","wireObjectTypeV2ToObjectInterfaceStringV1","uniqueLinkTargets","a","linkTarget","getDescriptionIfPresent","wirePropertyTypeV2ToTypeScriptType","propertyName","propertyDefinition","property","description","generatePerObjectInterfaceAndDataFiles","object","links","isNullableQueryDataType","t","wireQueryDataTypeToQueryDataTypeDefinition","allowNulls","nonnull","acc","f","get2DQueryAggregationProps","get3DQueryAggregationProps","guardInvalidKeyTypes","wireQueryTypeV2ToSdkQueryDefinition","parameter","wireQueryParameterV2ToQueryParameterDefinition","generatePerQueryDataFiles","objectTypes","getObjectTypesFromQuery","types","getObjectTypesFromDataType","prop","type","generateQueries","signatures","outputType","handleQueryDataType","paramEntries","nullable","sanitizeDocTypeName","param","field","isNullable","aggregationKeyToTypescriptType","aggregationValueToTypescriptType","keyType","aggregationRangeToTypescriptType","subType","valueType","generateClientSdkVersionOneDotOne","objectsDir","actionsDir","queriesDir","sanitizedOntology","wireObjectTypeV2ToObjectDefinitionInterfaceString","generateClientSdkVersionTwoPointZero","obj"],"mappings":"AAgBA,UAAYA,MAAU,OCAf,SAASC,EAAiBC,EAAU,CACzC,MAAO,CACL,GAAGA,EACH,YAAaA,EAAS,YAAY,IAAIC,IAC7B,CACL,GAAGA,EACH,QAASC,GAASD,EAAW,OAAO,CACtC,EACD,CACH,CACF,CACA,SAASC,GAASC,EAAM,CACtB,OAAOA,EAAK,QAAQ,MAAOC,GAAWA,EAAQ,CAAC,EAAE,YAAY,CAAC,CAChE,CCbA,OAAON,OAAU,OCAV,SAASO,EAAuBC,EAAQ,CAC7C,IAAMC,EAAe,IAAI,IACnBC,EAAkB,IAAI,IAC5B,QAAWC,KAAaH,EAAO,WAC7B,OAAQG,EAAU,KAAM,CACtB,IAAK,eACHF,EAAa,IAAIE,EAAU,iBAAiB,EAC5C,MACF,IAAK,eACHD,EAAgB,IAAIC,EAAU,iBAAiB,EAC/C,MACF,IAAK,eACL,IAAK,aACL,IAAK,aACH,MACF,QACE,IAAMC,EAAID,CACd,CAEF,MAAO,CACL,aAAAF,EACA,gBAAAC,CACF,CACF,CCvBA,OAAS,UAAAG,OAAc,WAGvB,OAAOC,OAAqB,mCACrB,SAASC,EAASC,EAAU,CACjC,OAAOH,GAAOG,EAAU,CACtB,OAAQ,aACR,YAAa,GACb,cAAe,MACf,QAAS,CAACF,EAAe,EACzB,SAAU,EACV,WAAY,GACd,CAAC,CACH,CFVA,eAAsBG,EAAgBf,EAAUgB,EAAIC,EAAQ,CAC1D,IAAMC,EAAkB,IAAI,IACxBC,EAAmB,CAAC,EACxB,QAAWb,KAAUN,EAAS,YAAa,CACzC,IAAMoB,EAAU,OAAO,QAAQd,EAAO,UAAU,EAC1Ce,EAAsBhB,EAAuBC,CAAM,EACnDC,EAAe,MAAM,KAAKc,EAAoB,YAAY,EAC1Db,EAAkB,MAAM,KAAKa,EAAoB,eAAe,EACtEd,EAAa,QAAQW,EAAgB,IAAKA,CAAe,EAC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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 */\n\nimport * as path from \"node:path\";\nimport { sanitizeMetadata } from \"../shared/sanitizeMetadata\";\nimport { generateActions } from \"./generateActions\";\nimport { generateFoundryClientFile } from \"./generateFoundryClientFile\";\nimport { generateIndexFile } from \"./generateIndexFile\";\nimport { generateMetadataFile } from \"./generateMetadataFile\";\nimport { generateObjectsInterfaceFile } from \"./generateObjectsInterfaceFile\";\nimport { generateOntologyIndexFile } from \"./generateOntologyIndexFile\";\nimport { generatePerActionDataFiles } from \"./generatePerActionDataFiles\";\nimport { generatePerObjectInterfaceAndDataFiles } from \"./generatePerObjectInterfaceAndDataFiles\";\nimport { generatePerQueryDataFiles } from \"./generatePerQueryDataFiles\";\nimport { generateQueries } from \"./generateQueries\";\nexport async function generateClientSdkVersionOneDotOne(ontology, fs, outDir) {\n const objectsDir = path.join(outDir, \"ontology\", \"objects\");\n const actionsDir = path.join(outDir, \"ontology\", \"actions\");\n const queriesDir = path.join(outDir, \"ontology\", \"queries\");\n const sanitizedOntology = sanitizeMetadata(ontology);\n await generateFoundryClientFile(fs, outDir);\n await generateMetadataFile(sanitizedOntology, fs, outDir);\n await generateOntologyIndexFile(fs, path.join(outDir, \"ontology\"));\n await generateObjectsInterfaceFile(sanitizedOntology, fs, objectsDir);\n await generatePerObjectInterfaceAndDataFiles(sanitizedOntology, fs, objectsDir);\n await generateActions(sanitizedOntology, fs, actionsDir);\n await generatePerActionDataFiles(sanitizedOntology, fs, actionsDir);\n await generateQueries(sanitizedOntology, fs, queriesDir);\n await generatePerQueryDataFiles(sanitizedOntology, fs, queriesDir);\n await generateIndexFile(fs, outDir);\n}","/*\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 */\n\nexport function sanitizeMetadata(ontology) {\n return {\n ...ontology,\n actionTypes: ontology.actionTypes.map(actionType => {\n return {\n ...actionType,\n apiName: camelize(actionType.apiName)\n };\n })\n };\n}\nfunction camelize(name) {\n return name.replace(/-./g, segment => segment[1].toUpperCase());\n}","/*\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 */\n\nimport path from \"path\";\nimport { getModifiedEntityTypes } from \"../shared/getEditedEntities\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateActions(ontology, fs, outDir) {\n const importedObjects = new Set();\n let actionSignatures = [];\n for (const action of ontology.actionTypes) {\n const entries = Object.entries(action.parameters);\n const modifiedEntityTypes = getModifiedEntityTypes(action);\n const addedObjects = Array.from(modifiedEntityTypes.addedObjects);\n const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);\n addedObjects.forEach(importedObjects.add, importedObjects);\n modifiedObjects.forEach(importedObjects.add, importedObjects);\n let jsDocBlock = [\"/**\"];\n if (action.description) {\n jsDocBlock.push(`* ${action.description}`);\n }\n let parameterBlock = \"\";\n if (entries.length > 0) {\n parameterBlock = `params: { \\n`;\n for (const [parameterName, parameterData] of entries) {\n parameterBlock += `\"${parameterName}\"`;\n parameterBlock += parameterData.required ? \": \" : \"?: \";\n const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);\n parameterBlock += `${typeScriptType};\\n`;\n jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);\n }\n parameterBlock += \"}, \";\n }\n jsDocBlock.push(`*/`);\n actionSignatures.push(`\n ${jsDocBlock.join(\"\\n\")}\n ${action.apiName}<O extends ActionExecutionOptions>(${parameterBlock}options?: O): \n Promise<Result<ActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(\" | \") : \"void\"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(\" | \") : \"void\"}>>, ActionError>>;`);\n }\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Actions.ts\"), await formatTs(`\n import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, ActionError, Result, ActionResponseFromOptions } from \"@osdk/legacy-client\";\n ${Array.from(importedObjects).map(importedObject => `import type { ${importedObject} } from \"../objects/${importedObject}\";`).join(\"\\n\")}\n export interface Actions {\n ${actionSignatures.join(\"\\n\")}\n }\n `));\n}\nfunction getTypeScriptTypeFromDataType(actionParameter, importedObjects) {\n switch (actionParameter.type) {\n case \"objectSet\":\n {\n const objectType = actionParameter.objectTypeApiName;\n importedObjects.add(objectType);\n return `ObjectSet<${objectType}>`;\n }\n case \"object\":\n {\n const objectType = actionParameter.objectTypeApiName;\n importedObjects.add(objectType);\n return `${objectType} | ${objectType}[\"__primaryKey\"]`;\n }\n case \"array\":\n return `Array<${getTypeScriptTypeFromDataType(actionParameter.subType, importedObjects)}>`;\n case \"string\":\n return `string`;\n case \"boolean\":\n return `boolean`;\n case \"attachment\":\n return `Attachment`;\n case \"date\":\n return `LocalDate`;\n case \"double\":\n case \"integer\":\n case \"long\":\n return `number`;\n case \"timestamp\":\n return `Timestamp`;\n default:\n const _ = actionParameter;\n throw new Error(`Unsupported action parameter type: ${actionParameter}`);\n }\n}","/*\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 */\n\nexport function getModifiedEntityTypes(action) {\n const addedObjects = new Set();\n const modifiedObjects = new Set();\n for (const operation of action.operations) {\n switch (operation.type) {\n case \"createObject\":\n addedObjects.add(operation.objectTypeApiName);\n break;\n case \"modifyObject\":\n modifiedObjects.add(operation.objectTypeApiName);\n break;\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n break;\n default:\n const _ = operation;\n }\n }\n return {\n addedObjects,\n modifiedObjects\n };\n}","/*\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 */\n\nimport { format } from \"prettier\";\n// @ts-ignore the plugin doesn't have types but we need to import the actual plugin\n// so we can bundle it rather than trying to resolve it at runtime\nimport organizeImports from \"prettier-plugin-organize-imports\";\nexport function formatTs(contents) {\n return format(contents, {\n parser: \"typescript\",\n singleQuote: true,\n trailingComma: \"all\",\n plugins: [organizeImports],\n tabWidth: 2,\n printWidth: 120\n });\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateFoundryClientFile(fs, outDir) {\n await fs.writeFile(path.join(outDir, \"FoundryClient.ts\"), await formatTs(`\n import { BaseFoundryClient } from \"@osdk/legacy-client\";\n import type { Auth, FoundryClientOptions } from \"@osdk/legacy-client\";\n import { Ontology } from \"./Ontology\";\n\n export class FoundryClient<TAuth extends Auth = Auth> extends BaseFoundryClient<typeof Ontology, TAuth> {\n constructor(options: FoundryClientOptions<TAuth>) {\n super(options, Ontology);\n }\n\n get ontology(): Ontology {\n return super.ontology;\n }\n }`));\n}","/*\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 */\n\nimport * as path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateIndexFile(fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export {\n ActionExecutionMode,\n ActionResponse,\n ActionValidationResult, \n ArrayType,\n AttachmentType,\n BooleanType,\n ByteType,\n DateType,\n DecimalType,\n DoubleType,\n FloatType,\n FoundryApiError,\n GeoPoint,\n GeoPointType,\n GeoShape,\n GeoShapeType,\n IntegerType,\n isErr,\n isOk, \n LocalDate,\n LongType,\n ObjectType,\n Op,\n Polygon,\n ReturnEditsMode,\n SetType,\n ShortType,\n StringType,\n StructField,\n StructType,\n TimeSeriesType,\n Timestamp,\n TimestampType,\n visitError,\n PublicClientAuth,\n ConfidentialClientAuth,\n UserTokenAuth\n } from '@osdk/legacy-client';\n export type {\n ActionError,\n AggregateObjectsError,\n AggregationGroup,\n AggregationResult, \n Attachment,\n AttachmentMetadata, \n AttachmentsError,\n Edits,\n ErrorVisitor,\n GetLinkedObjectError,\n GetObjectError,\n ListLinkedObjectsError,\n ListObjectsError,\n LoadObjectSetError,\n Page,\n PermissionDenied,\n QueryError,\n QueryResponse, \n Result,\n SearchObjectsError,\n TimeSeries,\n TimeSeriesError,\n TimeSeriesPoint, \n Unauthorized,\n UnknownError, \n } from '@osdk/legacy-client';\n export { Ontology } from \"./Ontology\";\n export { FoundryClient } from \"./FoundryClient\";\n `));\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { commaSeparatedIdentifiers } from \"../util/commaSeparatedIdentifiers\";\nimport { commaSeparatedTypeIdentifiers } from \"../util/commaSeparatedTypeIdentifiers\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateMetadataFile(ontology, fs, outDir) {\n const objectNames = Object.keys(ontology.objectTypes);\n const actionNames = ontology.actionTypes.map(action => action.apiName);\n const queryNames = ontology.queryTypes.map(query => query.apiName);\n const actionAltNames = new Map();\n const queryAltNames = new Map();\n const seenIdentifiers = new Set(objectNames);\n for (const actionName of actionNames) {\n if (seenIdentifiers.has(actionName)) {\n actionAltNames.set(actionName, `${actionName}Action`);\n } else {\n seenIdentifiers.add(actionName);\n }\n }\n for (const queryName of queryNames) {\n if (seenIdentifiers.has(queryName)) {\n queryAltNames.set(queryName, `${queryName}Query`);\n }\n }\n const getImportClause = (name, altNames) => {\n const alt = altNames.get(name);\n if (alt) {\n return `${name} as ${alt}`;\n } else {\n return name;\n }\n };\n await fs.writeFile(path.join(outDir, \"Ontology.ts\"), await formatTs(`\n import type { OntologyDefinition } from \"@osdk/api\";\n import type { Ontology as ClientOntology } from \"@osdk/legacy-client\";\n import type { Objects } from \"./ontology/objects/Objects\";\n import type { Actions } from \"./ontology/actions/Actions\";\n import type { Queries } from \"./ontology/queries/Queries\";\n ${objectNames.map(name => `import {${name}} from \"./ontology/objects/${name}\";`).join(\"\\n\")}\n ${actionNames.map(name => `import {${getImportClause(name, actionAltNames)}} from \"./ontology/actions/${name}\";`).join(\"\\n\")}\n ${queryNames.map(name => `import {${getImportClause(name, queryAltNames)}} from \"./ontology/queries/${name}\";`).join(\"\\n\")}\n\n export const Ontology : {\n metadata: {\n ontologyRid: \"${ontology.rid}\",\n ontologyApiName: \"${ontology.apiName}\",\n userAgent: \"foundry-typescript-osdk/0.0.1\",\n },\n objects: {\n ${commaSeparatedTypeIdentifiers(objectNames)}\n },\n actions: {\n ${commaSeparatedTypeIdentifiers(actionNames, actionAltNames)}\n },\n queries: {\n ${commaSeparatedTypeIdentifiers(queryNames, queryAltNames)}\n },\n } = {\n metadata: {\n ontologyRid: \"${ontology.rid}\" as const,\n ontologyApiName: \"${ontology.apiName}\" as const,\n userAgent: \"foundry-typescript-osdk/0.0.1\" as const,\n },\n objects: {\n ${commaSeparatedIdentifiers(objectNames)}\n },\n actions: {\n ${commaSeparatedIdentifiers(actionNames, actionAltNames)}\n },\n queries: {\n ${commaSeparatedIdentifiers(queryNames, queryAltNames)}\n }\n } satisfies OntologyDefinition<${objectNames.map(n => `\"${n}\"`).join(\"|\")}, ${ontology.actionTypes.map(actionType => `\"${actionType.apiName}\"`).join(\"|\")}, ${ontology.queryTypes.map(queryType => `\"${queryType.apiName}\"`).join(\"|\")}>;\n \nexport interface Ontology extends ClientOntology<typeof Ontology> {\n objects: Objects;\n actions: Actions;\n queries: Queries;\n}`));\n}","/*\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 */\n\nexport function commaSeparatedIdentifiers(identifiers, alternateNames) {\n return identifiers.map(i => {\n const alt = alternateNames?.get(i);\n if (alt) {\n return `${i}: ${alt}`;\n }\n return i;\n }).join(\",\");\n}","/*\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 */\n\nexport function commaSeparatedTypeIdentifiers(identifiers, altNames) {\n return identifiers.map(i => `${i}: typeof ${altNames?.get(i) ?? i}`).join(\",\");\n}","/*\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 */\n\nimport path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateObjectsInterfaceFile(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Objects.ts\"), await formatTs(`\n import { BaseObjectSet } from \"@osdk/legacy-client\";\n ${Array.from(Object.keys(ontology.objectTypes)).map(importedObject => `import type { ${importedObject} } from \"./${importedObject}\";`).join(\"\\n\")}\n \n export interface Objects {\n ${Object.keys(ontology.objectTypes).map(apiName => `${apiName} : BaseObjectSet<${apiName}>;`).join(\"\\n\")}\n }\n ;`));\n}","/*\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 */\n\nimport * as path from \"node:path\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateOntologyIndexFile(fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export type { ObjectSet } from \"@osdk/legacy-client\";\n `));\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireActionTypeV2ToSdkActionDefinition } from \"../shared/wireActionTypeV2ToSdkActionDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generatePerActionDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(ontology.actionTypes.map(async action => {\n const uniqueApiNames = new Set(extractReferencedObjectsFromAction(action));\n await fs.writeFile(path.join(outDir, `${action.apiName}.ts`), await formatTs(`\n import { ActionDefinition } from \"@osdk/api\";\n \n export const ${action.apiName} = ${JSON.stringify(wireActionTypeV2ToSdkActionDefinition(action), null, 2)} satisfies ActionDefinition<\"${action.apiName}\", ${uniqueApiNames.size > 0 ? [...uniqueApiNames].map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, `index.ts`), await formatTs(`\n ${ontology.actionTypes.map(action => `export * from \"./${action.apiName}\";`).join(\"\\n\")}\n `));\n}\nfunction extractReferencedObjectsFromAction(actionType) {\n const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({\n dataType\n }) => {\n const objectTypeReference = extractReferencedObjectsFromActionParameter(dataType);\n return objectTypeReference ? [objectTypeReference] : [];\n });\n const referenceObjectsInEdits = actionType.operations.flatMap(value => {\n switch (value.type) {\n case \"createObject\":\n return [value.objectTypeApiName];\n case \"modifyObject\":\n return [value.objectTypeApiName];\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n return [];\n }\n });\n return [...referenceObjectsInEdits, ...referencedObjectsInParameters];\n}\nfunction extractReferencedObjectsFromActionParameter(actionParameter) {\n switch (actionParameter.type) {\n case \"objectSet\":\n case \"object\":\n return actionParameter.objectTypeApiName;\n case \"array\":\n return extractReferencedObjectsFromActionParameter(actionParameter.subType);\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"date\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"timestamp\":\n return undefined;\n }\n}","/*\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 */\n\nimport { getModifiedEntityTypes } from \"./getEditedEntities\";\nexport function wireActionTypeV2ToSdkActionDefinition(input) {\n const modifiedEntityTypes = getModifiedEntityTypes(input);\n return {\n apiName: input.apiName,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([key, value]) => [key, wireActionParameterV2ToSdkParameterDefinition(value)])),\n displayName: input.displayName,\n description: input.description,\n modifiedEntities: createModifiedEntities(modifiedEntityTypes.addedObjects, modifiedEntityTypes.modifiedObjects)\n };\n}\nfunction wireActionParameterV2ToSdkParameterDefinition(value) {\n switch (value.dataType.type) {\n case \"string\":\n case \"boolean\":\n case \"object\":\n case \"attachment\":\n case \"date\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"objectSet\":\n case \"timestamp\":\n return {\n multiplicity: false,\n type: actionPropertyToSdkPropertyDefinition(value.dataType),\n nullable: value.required ? false : true,\n description: value.description\n };\n case \"array\":\n return {\n multiplicity: true,\n type: actionPropertyToSdkPropertyDefinition(value.dataType),\n nullable: value.required ? false : true,\n description: value.description\n };\n }\n}\nfunction actionPropertyToSdkPropertyDefinition(parameterType) {\n switch (parameterType.type) {\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"double\":\n case \"integer\":\n case \"long\":\n case \"timestamp\":\n return parameterType.type;\n case \"date\":\n return \"datetime\";\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: parameterType.objectTypeApiName\n };\n case \"object\":\n return {\n type: \"object\",\n object: parameterType.objectTypeApiName\n };\n case \"array\":\n return actionPropertyToSdkPropertyDefinition(parameterType.subType);\n }\n}\nfunction createModifiedEntities(addedObjects, modifiedObjects) {\n let entities = {};\n for (const key of addedObjects) {\n entities[key] = {\n created: true,\n modified: false\n };\n }\n for (const key of modifiedObjects) {\n if (entities[key]) {\n entities[key].modified = true;\n } else {\n entities[key] = {\n created: false,\n modified: true\n };\n }\n }\n return entities;\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireObjectTypeV2ToSdkObjectDefinition } from \"../shared/wireObjectTypeV2ToSdkObjectDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nimport { wireObjectTypeV2ToObjectInterfaceStringV1 } from \"./wireObjectTypeV2ToV1ObjectInterfaceString\";\nexport async function generatePerObjectInterfaceAndDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(Object.values(ontology.objectTypes).map(async object => {\n const links = ontology.linkTypes[object.apiName];\n const uniqueApiNames = new Set(links?.map(a => a.objectTypeApiName));\n await fs.writeFile(path.join(outDir, `${object.apiName}.ts`), await formatTs(`\n import { ObjectDefinition } from \"@osdk/api\";\n ${wireObjectTypeV2ToObjectInterfaceStringV1(object, links)}\n\n export const ${object.apiName} = ${JSON.stringify(wireObjectTypeV2ToSdkObjectDefinition(object, links), null, 2)} satisfies ObjectDefinition<\"${object.apiName}\", ${uniqueApiNames.size > 0 ? [...uniqueApiNames].map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n ${Object.keys(ontology.objectTypes).map(apiName => `export * from \"./${apiName}\";`).join(\"\\n\")}\n export type { ObjectSet } from \"@osdk/legacy-client\";\\n\n `));\n}","/*\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 */\n\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"attachment\":\n case \"byte\":\n case \"decimal\":\n case \"float\":\n case \"geopoint\":\n case \"geoshape\":\n case \"long\":\n case \"short\":\n {\n return input.dataType.type;\n }\n case \"date\":\n {\n return \"datetime\";\n }\n case \"timestamp\":\n {\n return \"timestamp\";\n }\n case \"timeseries\":\n case \"array\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}","/*\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 */\n\nexport function wirePropertyV2ToSdkPropertyDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"date\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n return {\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n case \"array\":\n {\n return {\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true\n };\n }\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\n switch (propertyType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n return propertyType.type;\n case \"date\":\n return \"datetime\";\n case \"array\":\n return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);\n case \"timeseries\":\n if (propertyType.itemType.type === \"string\") {\n return \"stringTimeseries\";\n }\n return \"numericTimeseries\";\n default:\n const _ = propertyType;\n throw new Error(`Unexecpected data type ${propertyType}`);\n }\n}","/*\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 */\n\nimport { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition\";\nexport function wireObjectTypeV2ToSdkObjectDefinition(input, linkTypes = []) {\n return {\n apiName: input.apiName,\n description: input.description,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input.properties[input.primaryKey]),\n links: Object.fromEntries(linkTypes.map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName\n }];\n })),\n properties: Object.fromEntries(Object.entries(input.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value)]))\n };\n}","/*\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 */\n\n// This must match the reservedKeywords definition in packages/legacy-client\nconst reservedKeywords = new Set([\"break\", \"case\", \"catch\", \"class\", \"const\", \"continue\", \"debugger\", \"default\", \"delete\", \"do\", \"else\", \"enum\", \"export\", \"extends\", \"false\", \"finally\", \"for\", \"function\", \"if\", \"import\", \"in\", \"instanceof\", \"new\", \"null\", \"return\", \"super\", \"switch\", \"this\", \"throw\", \"true\", \"try\", \"typeof\", \"var\", \"void\", \"while\", \"with\", \"implements\", \"interface\", \"let\", \"package\", \"private\", \"protected\", \"public\", \"static\", \"yield\"]);\nexport function isReservedKeyword(name) {\n return reservedKeywords.has(name);\n}","/*\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 */\n\nimport { isReservedKeyword } from \"../util/reservedKeywords\";\nexport function wireObjectTypeV2ToObjectInterfaceStringV1(input, linkTypes = []) {\n const uniqueLinkTargets = new Set(linkTypes.map(a => a.objectTypeApiName).filter(a => a !== input.apiName));\n return `import type { OntologyObject, LocalDate, Timestamp, GeoShape, GeoPoint, Attachment, TimeSeries, MultiLink, SingleLink } from \"@osdk/legacy-client\";\n${Array.from(uniqueLinkTargets).map(linkTarget => `import type { ${linkTarget} } from \"./${linkTarget}\";`).join(\"\\n\")}\n\n ${getDescriptionIfPresent(input.description)}export interface ${input.apiName} extends OntologyObject {\n readonly __apiName: \"${input.apiName}\";\n readonly __primaryKey: ${wirePropertyTypeV2ToTypeScriptType(input.properties[input.primaryKey].dataType)};\n${Object.entries(input.properties).flatMap(([propertyName, propertyDefinition]) => {\n const propertyType = wirePropertyTypeV2ToTypeScriptType(propertyDefinition.dataType);\n const entries = [`${getDescriptionIfPresent(propertyDefinition.description)}readonly ${propertyName}: ${propertyType} | undefined`];\n if (isReservedKeyword(propertyName)) {\n entries.push(`/** @deprecated please migrate to '${propertyName}' instead */\n readonly ${propertyName}_: ${propertyType} | undefined`);\n }\n return entries;\n }).join(\";\\n\")}\n${linkTypes.flatMap(linkType => {\n const entries = [`readonly ${linkType.apiName}: ${linkType.cardinality === \"MANY\" ? \"MultiLink\" : \"SingleLink\"}<${linkType.objectTypeApiName}>`];\n return entries;\n }).join(\";\\n\")}\n}\n `;\n}\nfunction wirePropertyTypeV2ToTypeScriptType(property) {\n switch (property.type) {\n case \"string\":\n return \"string\";\n case \"boolean\":\n return \"boolean\";\n case \"array\":\n return wirePropertyTypeV2ToTypeScriptType(property.subType) + \"[]\";\n case \"integer\":\n return \"number\";\n case \"attachment\":\n return \"Attachment\";\n case \"byte\":\n return \"number\";\n case \"date\":\n return \"LocalDate\";\n case \"decimal\":\n return \"number\";\n case \"double\":\n return \"number\";\n case \"float\":\n return \"number\";\n case \"geopoint\":\n return \"GeoPoint\";\n case \"geoshape\":\n return \"GeoShape\";\n case \"long\":\n return \"number\";\n case \"short\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"timeseries\":\n return property.itemType.type === \"string\" ? `TimeSeries<string>` : `TimeSeries<number>`;\n default:\n const _ = property;\n throw new Error(`Unknown property type ${property}`);\n }\n}\nfunction getDescriptionIfPresent(description) {\n if (description) {\n return `/**\n * ${description}\n */\\n`;\n }\n return \"\";\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireQueryTypeV2ToSdkQueryDefinition } from \"../shared/wireQueryTypeV2ToSdkQueryDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generatePerQueryDataFiles(ontology, fs, outDir) {\n await fs.mkdir(outDir, {\n recursive: true\n });\n await Promise.all(ontology.queryTypes.map(async query => {\n const objectTypes = getObjectTypesFromQuery(query);\n await fs.writeFile(path.join(outDir, `${query.apiName}.ts`), await formatTs(`\n import { QueryDefinition } from \"@osdk/api\";\n\n export const ${query.apiName} = ${JSON.stringify(wireQueryTypeV2ToSdkQueryDefinition(query))} satisfies QueryDefinition<\"${query.apiName}\", ${objectTypes.length > 0 ? objectTypes.map(apiName => `\"${apiName}\"`).join(\"|\") : \"never\"}>;`));\n }));\n await fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n ${ontology.queryTypes.map(query => `export * from \"./${query.apiName}\";`).join(\"\\n\")}\n `));\n}\nfunction getObjectTypesFromQuery(query) {\n const types = new Set();\n for (const {\n dataType\n } of Object.values(query.parameters)) {\n getObjectTypesFromDataType(dataType, types);\n }\n getObjectTypesFromDataType(query.output, types);\n return Array.from(types);\n}\nfunction getObjectTypesFromDataType(dataType, types) {\n switch (dataType.type) {\n case \"array\":\n case \"set\":\n getObjectTypesFromDataType(dataType.subType, types);\n return;\n case \"object\":\n types.add(dataType.objectTypeApiName);\n return;\n case \"objectSet\":\n types.add(dataType.objectTypeApiName);\n return;\n case \"struct\":\n for (const prop of Object.values(dataType.fields)) {\n getObjectTypesFromDataType(prop.fieldType, types);\n }\n return;\n case \"union\":\n for (const type of dataType.unionTypes) {\n getObjectTypesFromDataType(type, types);\n }\n return;\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"null\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n case \"unsupported\":\n /* complete no-op */\n return;\n default:\n const _ = dataType;\n throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);\n }\n}","/*\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 */\n\nexport function isNullableQueryDataType(input) {\n if (input.type === \"null\") {\n return true;\n }\n if (input.type === \"union\") {\n return input.unionTypes.some(t => isNullableQueryDataType(t));\n }\n return false;\n}","/*\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 */\n\nimport { isNullableQueryDataType } from \"./isNullableQueryDataType\";\nexport function wireQueryDataTypeToQueryDataTypeDefinition(input) {\n switch (input.type) {\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"string\":\n case \"timestamp\":\n return {\n type: input.type,\n nullable: false\n };\n case \"object\":\n return {\n type: {\n type: \"object\",\n object: input.objectTypeApiName\n },\n nullable: false\n };\n case \"objectSet\":\n return {\n type: {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName\n },\n nullable: false\n };\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true\n };\n case \"set\":\n return {\n type: {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType)\n },\n nullable: false\n };\n case \"union\":\n const allowNulls = isNullableQueryDataType(input);\n\n // special case for a union where one half is nullable to skip the union step and just allow nulls directly\n if (allowNulls && input.unionTypes.length === 2) {\n const nonnull = input.unionTypes.find(t => t.type !== null);\n if (nonnull) {\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(nonnull),\n nullable: true\n };\n }\n }\n return {\n type: {\n type: \"union\",\n union: input.unionTypes.reduce((acc, t) => {\n if (t.type === \"null\") {\n return acc;\n }\n acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));\n return acc;\n }, [])\n },\n nullable: allowNulls\n };\n case \"struct\":\n return {\n type: {\n type: \"struct\",\n struct: Object.fromEntries(input.fields.map(f => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)]))\n },\n nullable: false\n };\n case \"twoDimensionalAggregation\":\n return {\n type: {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input)\n }\n };\n case \"threeDimensionalAggregation\":\n return {\n type: {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input)\n }\n };\n case \"null\":\n case \"unsupported\":\n throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);\n default:\n const _ = input;\n throw new Error(`Unsupported QueryDataType.type ${input.type}`);\n }\n}\nfunction get2DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: input.valueType.type\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: input.valueType.type\n };\n }\n throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);\n }\n}\nfunction get3DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: get2DQueryAggregationProps(input.valueType)\n };\n } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: get2DQueryAggregationProps(input.valueType)\n };\n }\n throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);\n }\n}\n\n/**\n * Guard against aggregation key types that are allowed by the backend types but are illegal to actually use\n */\nfunction guardInvalidKeyTypes(key) {\n return key.type === \"string\" || key.type === \"boolean\";\n}","/*\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 */\n\nimport { wireQueryDataTypeToQueryDataTypeDefinition } from \"./wireQueryDataTypeToQueryDataTypeDefinition\";\nexport function wireQueryTypeV2ToSdkQueryDefinition(input) {\n return {\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n rid: input.rid,\n version: input.version,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),\n output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)\n };\n}\nfunction wireQueryParameterV2ToQueryParameterDefinition(parameter) {\n return {\n description: parameter.description,\n dataType: wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)\n };\n}","/*\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 */\n\nimport path from \"path\";\nimport { isNullableQueryDataType } from \"../shared/isNullableQueryDataType\";\nimport { formatTs } from \"../util/test/formatTs\";\nexport async function generateQueries(ontology, fs, outDir) {\n const importedObjects = new Set();\n const signatures = [];\n for (const query of ontology.queryTypes) {\n const jsDocBlock = [\"/**\"];\n if (query.description) {\n jsDocBlock.push(`* ${query.description}`);\n }\n const outputType = handleQueryDataType(query.output, importedObjects);\n const paramEntries = [];\n for (const [name, parameter] of Object.entries(query.parameters)) {\n const nullable = isNullableQueryDataType(parameter.dataType);\n const type = handleQueryDataType(parameter.dataType, importedObjects);\n paramEntries.push(`\"${name}\"${nullable ? \"?\" : \"\"}: ${type}`);\n jsDocBlock.push(`* @param {${sanitizeDocTypeName(type)}} params.${name}${parameter.description ? ` - ${parameter.description}` : \"\"}`);\n }\n const param = paramEntries.length === 0 ? \"\" : `params: { ${paramEntries.join(\"; \")} }`;\n jsDocBlock.push(`* @returns ${sanitizeDocTypeName(outputType)}`, \"*/\");\n signatures.push(`\n ${jsDocBlock.join(\"\\n\")}\n ${query.apiName}(${param}): Promise<Result<QueryResponse<${outputType}>, QueryError>>;\n `);\n }\n await fs.mkdir(outDir, {\n recursive: true\n });\n await fs.writeFile(path.join(outDir, \"Queries.ts\"), await formatTs(`\n import type { QueryResponse, QueryError, Result, Timestamp, LocalDate, Range, Attachment, ObjectSet, TwoDimensionalAggregation, ThreeDimensionalAggregation } from \"@osdk/legacy-client\";\n ${Array.from(importedObjects).map(importedObject => `import type { ${importedObject} } from \"../objects/${importedObject}\";`).join(\"\\n\")}\n\n export interface Queries {\n ${signatures.join(\"\\n\")}\n }\n `));\n}\nfunction handleQueryDataType(dataType, importedObjects) {\n switch (dataType.type) {\n case \"boolean\":\n return \"boolean\";\n case \"string\":\n return \"string\";\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n return \"number\";\n case \"date\":\n return \"LocalDate\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"attachment\":\n return \"Attachment\";\n case \"array\":\n return `Array<${handleQueryDataType(dataType.subType, importedObjects)}>`;\n case \"object\":\n {\n const objectType = dataType.objectTypeApiName;\n importedObjects.add(objectType);\n return `${objectType} | ${objectType}[\"__primaryKey\"]`;\n }\n case \"objectSet\":\n {\n const objectType = dataType.objectTypeApiName;\n importedObjects.add(objectType);\n return `ObjectSet<${objectType}>`;\n }\n case \"set\":\n return `Set<${handleQueryDataType(dataType.subType, importedObjects)}>`;\n case \"struct\":\n const properties = dataType.fields.map(field => {\n const isNullable = isNullableQueryDataType(field.fieldType);\n return `${field.name}${isNullable ? \"?\" : \"\"}: ${handleQueryDataType(field.fieldType, importedObjects)}`;\n });\n return `{ ${properties.join(\",\\n\")} }`;\n case \"union\":\n return dataType.unionTypes.map(type => handleQueryDataType(type, importedObjects)).filter(type => type !== \"null\").join(\"|\");\n case \"twoDimensionalAggregation\":\n dataType.valueType;\n return `TwoDimensionalAggregation<\n ${aggregationKeyToTypescriptType(dataType.keyType)},\n ${aggregationValueToTypescriptType(dataType.valueType)}\n >`;\n case \"threeDimensionalAggregation\":\n return `ThreeDimensionalAggregation<\n ${aggregationKeyToTypescriptType(dataType.keyType)},\n ${aggregationKeyToTypescriptType(dataType.valueType.keyType)},\n ${aggregationValueToTypescriptType(dataType.valueType.valueType)}\n >`;\n case \"null\":\n return \"null\";\n case \"unsupported\":\n throw new Error(\"Cannot generate queries for unsupported type\");\n default:\n const _ = dataType;\n throw new Error(`Cannot generate queries for type ${dataType.type}`);\n }\n}\nfunction aggregationKeyToTypescriptType(keyType) {\n switch (keyType.type) {\n case \"boolean\":\n return \"boolean\";\n case \"double\":\n case \"integer\":\n return \"number\";\n case \"string\":\n return \"string\";\n case \"date\":\n return \"LocalDate\";\n case \"timestamp\":\n return \"Timestamp\";\n case \"range\":\n return `Range<${aggregationRangeToTypescriptType(keyType.subType)}>`;\n default:\n const _ = keyType;\n throw new Error(`Unknown TwoDimensionalAggregation keyType ${keyType.type}`);\n }\n}\nfunction aggregationRangeToTypescriptType(subType) {\n switch (subType.type) {\n case \"date\":\n return \"LocalDate\";\n case \"double\":\n case \"integer\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n default:\n const _ = subType;\n throw new Error(`Unsupported QueryAggregationRangeSubType ${subType.type}`);\n }\n}\nfunction aggregationValueToTypescriptType(valueType) {\n switch (valueType.type) {\n case \"date\":\n return \"LocalDate\";\n case \"double\":\n return \"number\";\n case \"timestamp\":\n return \"Timestamp\";\n default:\n const _ = valueType;\n throw new Error(`Unsupported QueryAggregationValueType ${valueType.type}`);\n }\n}\nfunction sanitizeDocTypeName(type) {\n return type.replace(/\\s/g, \"\");\n}","/*\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 */\n\nimport path from \"path\";\nimport { wireObjectTypeV2ToSdkObjectDefinition } from \"../shared/wireObjectTypeV2ToSdkObjectDefinition\";\nimport { formatTs } from \"../util/test/formatTs\";\nimport { wireObjectTypeV2ToObjectDefinitionInterfaceString } from \"./wireObjectTypeV2ToObjectDefinitionInterfaceString\";\nexport async function generateClientSdkVersionTwoPointZero(ontology, fs, outDir) {\n fs.writeFile(path.join(outDir, \"index.ts\"), await formatTs(`\n export { Ontology } from \"./Ontology\";\n `));\n const objectNames = Object.keys(ontology.objectTypes);\n fs.writeFile(path.join(outDir, \"Ontology.ts\"), await formatTs(`\n import type { OntologyDefinition } from \"@osdk/api\";\n ${objectNames.map(name => `import {${name}} from \"./objects/${name}\";`).join(\"\\n\")}\n ${/* FIXME: Generate this file */\"\"}\n import { OntologyMetadata } from \"./OntologyMetadata\";\n \n export const Ontology = {\n metadata: OntologyMetadata,\n objects: {\n ${objectNames.map(name => `${name}: ${name},`).join(\"\\n\")}\n },\n } satisfies OntologyDefinition<${objectNames.map(n => `\"${n}\"`).join(\"|\")}>;\n `));\n for (const name of objectNames) {\n const obj = ontology.objectTypes[name];\n fs.writeFile(path.join(outDir, `objects`, `${name}.ts`), await formatTs(`\n \n import type { ObjectDefinition } from \"@osdk/api\";\n\n export const ${name} = ${JSON.stringify(wireObjectTypeV2ToSdkObjectDefinition(obj), null, 2)} satisfies ${name};\n\n ${wireObjectTypeV2ToObjectDefinitionInterfaceString(obj)}\n `));\n }\n}","/*\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 */\n\nexport function wireObjectTypeV2ToObjectDefinitionInterfaceString(input) {\n return `\n export interface ${input.apiName} extends ObjectDefinition<\"${input.apiName}\", \"${input.apiName}\">{\n apiName: \"${input.apiName}\";\n properties: {\n ${Object.entries(input.properties).map(([key, value]) => `\n /**\n * ${value.description ?? \"\"}\n **/\n ${key}: {\n type: \"${value.dataType.type}\";\n displayName: \"${value.displayName ?? key}\";\n }\n \n `)}\n }\n }\n `;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/generator",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -21,8 +21,8 @@
21
21
  "prettier": "^3.0.3",
22
22
  "prettier-plugin-organize-imports": "^3.2.3",
23
23
  "tiny-invariant": "^1.3.1",
24
- "@osdk/api": "0.0.12",
25
- "@osdk/gateway": "0.0.5"
24
+ "@osdk/api": "0.0.13",
25
+ "@osdk/gateway": "0.0.6"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^16.11.11",