@osdk/maker 0.8.2-rc.0 → 0.8.2

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,36 @@
1
1
  # @osdk/maker
2
2
 
3
+ ## 0.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 76defb9: Allowing interfaces to extend other interfaces for ontology as code.
8
+ - 76defb9: Add media reference to maker
9
+ - Updated dependencies [1edf95b]
10
+ - Updated dependencies [4c5e0ae]
11
+ - @osdk/api@2.0.2
12
+
13
+ ## 0.8.2-rc.3
14
+
15
+ ### Patch Changes
16
+
17
+ - 76defb9: Allowing interfaces to extend other interfaces for ontology as code.
18
+ - 76defb9: Add media reference to maker
19
+ - Updated dependencies [4c5e0ae]
20
+ - @osdk/api@2.0.2-rc.3
21
+
22
+ ## 0.8.2-beta.2
23
+
24
+ ### Patch Changes
25
+
26
+ - @osdk/api@2.0.2-beta.2
27
+
28
+ ## 0.8.2-beta.1
29
+
30
+ ### Patch Changes
31
+
32
+ - @osdk/api@2.0.2-beta.1
33
+
3
34
  ## 0.8.2-rc.0
4
35
 
5
36
  ### Patch Changes
@@ -9,6 +9,6 @@ export declare function defineInterface(opts: {
9
9
  color: string;
10
10
  };
11
11
  properties?: Record<string, SharedPropertyType | PropertyTypeType>;
12
- extends?: InterfaceType[] | string[];
12
+ extends?: InterfaceType | InterfaceType[] | string | string[];
13
13
  }): InterfaceType;
14
14
  //# sourceMappingURL=defineInterface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defineInterface.d.ts","sourceRoot":"","sources":["../../../src/api/defineInterface.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,eAAe,CAC7B,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CACjB,MAAM,EACN,kBAAkB,GAAG,gBAAgB,CACtC,CAAC;IACF,OAAO,CAAC,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAAC;CACtC,GACA,aAAa,CA2Df"}
1
+ {"version":3,"file":"defineInterface.d.ts","sourceRoot":"","sources":["../../../src/api/defineInterface.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,eAAe,CAC7B,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CACjB,MAAM,EACN,kBAAkB,GAAG,gBAAgB,CACtC,CAAC;IACF,OAAO,CAAC,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;CAC/D,GACA,aAAa,CA2Ef"}
@@ -37,7 +37,18 @@ export function defineInterface(opts) {
37
37
  return [apiName, type];
38
38
  }
39
39
  }));
40
- // (opts.extends ?? []).map(val => {(val is InterfaceType) ? val :;});
40
+ let extendsInterfaces = [];
41
+ if (opts.extends) {
42
+ if (typeof opts.extends === "string") {
43
+ extendsInterfaces = [opts.extends];
44
+ } else if (Array.isArray(opts.extends) && opts.extends.every(item => typeof item === "string")) {
45
+ extendsInterfaces = opts.extends;
46
+ } else if (opts.extends.apiName !== undefined) {
47
+ extendsInterfaces = [opts.extends.apiName];
48
+ } else {
49
+ extendsInterfaces = opts.extends.map(item => item.apiName);
50
+ }
51
+ }
41
52
  const a = {
42
53
  apiName,
43
54
  displayMetadata: {
@@ -51,7 +62,7 @@ export function defineInterface(opts) {
51
62
  }
52
63
  } : undefined
53
64
  },
54
- extendsInterfaces: [],
65
+ extendsInterfaces: extendsInterfaces,
55
66
  links: [],
56
67
  properties,
57
68
  status: {
@@ -1 +1 @@
1
- {"version":3,"file":"defineInterface.js","names":["invariant","namespace","ontologyDefinition","defineSharedPropertyType","defineInterface","opts","apiName","interfaceTypes","undefined","properties","Object","fromEntries","entries","map","type","isSimpleType","spt","displayName","array","JSON","stringify","key","a","displayMetadata","description","icon","blueprint","color","locator","extendsInterfaces","links","status","active","v"],"sources":["defineInterface.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport invariant from \"tiny-invariant\";\nimport { namespace, ontologyDefinition } from \"./defineOntology.js\";\nimport { defineSharedPropertyType } from \"./defineSpt.js\";\nexport function defineInterface(opts) {\n const apiName = namespace + opts.apiName;\n invariant(ontologyDefinition.interfaceTypes[apiName] === undefined, `Interface ${apiName} already exists`);\n const properties = Object.fromEntries(Object.entries(opts.properties ?? {}).map(([apiName, type]) => {\n if (typeof type === \"string\") {\n invariant(isSimpleType(type), `Invalid data type ${type} for property ${apiName} on InterfaceType ${apiName}`);\n const spt = defineSharedPropertyType({\n apiName,\n displayName: apiName,\n type,\n array: false,\n });\n return [apiName, spt];\n }\n else {\n invariant(namespace + apiName === type.apiName, `property key and it's apiName must be identical. ${JSON.stringify({ key: apiName, apiName: type.apiName })}`);\n return [apiName, type];\n }\n }));\n // (opts.extends ?? []).map(val => {(val is InterfaceType) ? val :;});\n const a = {\n apiName,\n displayMetadata: {\n displayName: opts.displayName ?? opts.apiName,\n description: opts.description ?? opts.displayName ?? opts.apiName,\n icon: opts.icon !== undefined\n ? {\n type: \"blueprint\",\n blueprint: { color: opts.icon.color, locator: opts.icon.locator },\n }\n : undefined,\n },\n extendsInterfaces: [],\n links: [],\n properties,\n status: { type: \"active\", active: {} },\n };\n return ontologyDefinition.interfaceTypes[apiName] = a;\n}\nfunction isSimpleType(v) {\n return v === \"boolean\" || v === \"byte\"\n || v === \"date\" || v === \"decimal\" || v === \"double\"\n || v === \"float\" || v === \"geopoint\" || v === \"geoshape\"\n || v === \"integer\" || v === \"long\" || v === \"marking\"\n || v === \"short\" || v === \"string\"\n || v === \"timestamp\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,qBAAqB;AACnE,SAASC,wBAAwB,QAAQ,gBAAgB;AACzD,OAAO,SAASC,eAAeA,CAACC,IAAI,EAAE;EAClC,MAAMC,OAAO,GAAGL,SAAS,GAAGI,IAAI,CAACC,OAAO;EACxC,EAAUJ,kBAAkB,CAACK,cAAc,CAACD,OAAO,CAAC,KAAKE,SAAS,IAAlER,SAAS,QAA2D,aAAaM,OAAO,iBAAiB;EACzG,MAAMG,UAAU,GAAGC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACP,IAAI,CAACI,UAAU,IAAI,CAAC,CAAC,CAAC,CAACI,GAAG,CAAC,CAAC,CAACP,OAAO,EAAEQ,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AAM,EAAE,CAAC;IAAE;EACzC,CAAC;EACD,OAAO9B,kBAAkB,CAACK,cAAc,CAACD,OAAO,CAAC,GAAGgB,CAAC;AACzD;AACA,SAASP,YAAYA,CAACkB,CAAC,EAAE;EACrB,OAAOA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IAC/BA,CAAC,KAAK,MAAM,IAAIA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,QAAQ,IACjDA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,UAAU,IAAIA,CAAC,KAAK,UAAU,IACrDA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IAAIA,CAAC,KAAK,SAAS,IAClDA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,QAAQ,IAC/BA,CAAC,KAAK,WAAW;AAC5B","ignoreList":[]}
1
+ {"version":3,"file":"defineInterface.js","names":["invariant","namespace","ontologyDefinition","defineSharedPropertyType","defineInterface","opts","apiName","interfaceTypes","undefined","properties","Object","fromEntries","entries","map","type","isSimpleType","spt","displayName","array","JSON","stringify","key","extendsInterfaces","extends","Array","isArray","every","item","a","displayMetadata","description","icon","blueprint","color","locator","links","status","active","v"],"sources":["defineInterface.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport invariant from \"tiny-invariant\";\nimport { namespace, ontologyDefinition } from \"./defineOntology.js\";\nimport { defineSharedPropertyType } from \"./defineSpt.js\";\nexport function defineInterface(opts) {\n const apiName = namespace + opts.apiName;\n invariant(ontologyDefinition.interfaceTypes[apiName] === undefined, `Interface ${apiName} already exists`);\n const properties = Object.fromEntries(Object.entries(opts.properties ?? {}).map(([apiName, type]) => {\n if (typeof type === \"string\") {\n invariant(isSimpleType(type), `Invalid data type ${type} for property ${apiName} on InterfaceType ${apiName}`);\n const spt = defineSharedPropertyType({\n apiName,\n displayName: apiName,\n type,\n array: false,\n });\n return [apiName, spt];\n }\n else {\n invariant(namespace + apiName === type.apiName, `property key and it's apiName must be identical. ${JSON.stringify({ key: apiName, apiName: type.apiName })}`);\n return [apiName, type];\n }\n }));\n let extendsInterfaces = [];\n if (opts.extends) {\n if (typeof opts.extends === \"string\") {\n extendsInterfaces = [opts.extends];\n }\n else if (Array.isArray(opts.extends)\n && opts.extends.every(item => typeof item === \"string\")) {\n extendsInterfaces = opts.extends;\n }\n else if (opts.extends.apiName !== undefined) {\n extendsInterfaces = [opts.extends.apiName];\n }\n else {\n extendsInterfaces = opts.extends.map(item => item.apiName);\n }\n }\n const a = {\n apiName,\n displayMetadata: {\n displayName: opts.displayName ?? opts.apiName,\n description: opts.description ?? opts.displayName ?? opts.apiName,\n icon: opts.icon !== undefined\n ? {\n type: \"blueprint\",\n blueprint: { color: opts.icon.color, locator: opts.icon.locator },\n }\n : undefined,\n },\n extendsInterfaces: extendsInterfaces,\n links: [],\n properties,\n status: { type: \"active\", active: {} },\n };\n return ontologyDefinition.interfaceTypes[apiName] = a;\n}\nfunction isSimpleType(v) {\n return v === \"boolean\" || v === \"byte\"\n || v === \"date\" || v === \"decimal\" || v === \"double\"\n || v === \"float\" || v === \"geopoint\" || v === \"geoshape\"\n || v === \"integer\" || v === \"long\" || v === \"marking\"\n || v === \"short\" || v === \"string\"\n || v === \"timestamp\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,qBAAqB;AACnE,SAASC,wB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CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IAC/BA,CAAC,KAAK,MAAM,IAAIA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,QAAQ,IACjDA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,UAAU,IAAIA,CAAC,KAAK,UAAU,IACrDA,CAAC,KAAK,SAAS,IAAIA,CAAC,KAAK,MAAM,IAAIA,CAAC,KAAK,SAAS,IAClDA,CAAC,KAAK,OAAO,IAAIA,CAAC,KAAK,QAAQ,IAC/BA,CAAC,KAAK,WAAW;AAC5B","ignoreList":[]}
@@ -154,6 +154,11 @@ function convertType(type) {
154
154
  supportsExactMatching: true
155
155
  }
156
156
  };
157
+ case "mediaReference":
158
+ return {
159
+ type: type,
160
+ mediaReference: {}
161
+ };
157
162
  default:
158
163
  // use helper function to distribute `type` properly
159
164
  return distributeTypeHelper(type);
@@ -1 +1 @@
1
- {"version":3,"file":"defineOntology.js","names":["ontologyDefinition","namespace","defineOntology","ns","body","actionTypes","objectTypes","queryTypes","interfaceTypes","sharedPropertyTypes","valueTypes","e","console","error","ontology","convertToWireOntologyIr","valueType","convertOntologyToValueTypeIr","Object","values","map","definitions","metadata","apiName","displayMetadata","status","versions","definition","version","baseType","constraints","exampleValues","fromEntries","entries","spt","sharedPropertyType","convertSpt","interfaceType","convertInterface","blockPermissionInformation","linkTypes","properties","allExtendsInterfaces","allLinks","allProperties","dumpOntologyFullMetadata","dumpValueTypeWireType","type","array","description","displayName","gothamMapping","typeClasses","visibility","subtype","convertType","aliases","baseFormatter","undefined","dataConstraints","indexedForSearch","provenance","markingType","geohash","precision","scale","analyzerOverride","enableAsciiFolding","isLongText","supportsExactMatching","distributeTypeHelper"],"sources":["defineOntology.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** @internal */\nexport let ontologyDefinition;\n/** @internal */\nexport let namespace;\nexport async function defineOntology(ns, body) {\n namespace = ns;\n ontologyDefinition = {\n actionTypes: {},\n objectTypes: {},\n queryTypes: {},\n interfaceTypes: {},\n sharedPropertyTypes: {},\n valueTypes: {},\n };\n try {\n await body();\n }\n catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected error while processing the body of the ontology\", e);\n throw e;\n }\n return {\n ontology: convertToWireOntologyIr(ontologyDefinition),\n valueType: convertOntologyToValueTypeIr(ontologyDefinition),\n };\n}\nfunction convertOntologyToValueTypeIr(ontology) {\n return {\n valueTypes: Object.values(ontology.valueTypes).map(definitions => ({\n metadata: {\n apiName: definitions[0].apiName,\n displayMetadata: definitions[0].displayMetadata,\n status: definitions[0].status,\n },\n versions: definitions.map(definition => ({\n version: definition.version,\n baseType: definition.baseType,\n constraints: definition.constraints,\n exampleValues: definition.exampleValues,\n })),\n })),\n };\n}\nfunction convertToWireOntologyIr(ontology) {\n return {\n sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes)\n .map(([apiName, spt]) => [apiName, { sharedPropertyType: convertSpt(spt) }])),\n interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes)\n .map(([apiName, interfaceType]) => {\n return [apiName, {\n interfaceType: convertInterface(interfaceType),\n }];\n })),\n blockPermissionInformation: {\n actionTypes: {},\n linkTypes: {},\n objectTypes: {},\n },\n };\n}\nfunction convertInterface(interfaceType) {\n return {\n ...interfaceType,\n properties: Object.values(interfaceType.properties)\n .map((spt) => convertSpt(spt)),\n // these are omitted from our internal types but we need to re-add them for the final json\n allExtendsInterfaces: [],\n allLinks: [],\n allProperties: [],\n };\n}\nexport function dumpOntologyFullMetadata() {\n return convertToWireOntologyIr(ontologyDefinition);\n}\nexport function dumpValueTypeWireType() {\n return convertOntologyToValueTypeIr(ontologyDefinition);\n}\nfunction convertSpt({ type, array, description, apiName, displayName, gothamMapping, typeClasses, valueType, }) {\n return {\n apiName,\n displayMetadata: {\n displayName: displayName ?? apiName,\n visibility: \"NORMAL\",\n description,\n },\n type: array\n ? {\n type: \"array\",\n array: {\n subtype: convertType(type),\n },\n }\n : convertType(type),\n aliases: [],\n baseFormatter: undefined,\n dataConstraints: undefined,\n gothamMapping: gothamMapping,\n indexedForSearch: true,\n provenance: undefined,\n typeClasses: typeClasses ?? [],\n valueType: valueType,\n };\n}\nfunction convertType(type) {\n switch (type) {\n case \"marking\":\n return { type, [type]: { markingType: \"MANDATORY\" } };\n case \"geopoint\":\n return { type: \"geohash\", geohash: {} };\n case \"decimal\":\n return { type, [type]: { precision: undefined, scale: undefined } };\n case \"string\":\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsExactMatching: true,\n },\n };\n default:\n // use helper function to distribute `type` properly\n return distributeTypeHelper(type);\n }\n}\n/**\n * Helper function to avoid duplication. Makes the types match properly with the correct\n * behavior without needing to switch on type.\n * @param type\n * @returns\n */\nfunction distributeTypeHelper(type) {\n return { type, [type]: {} }; // any cast to match conditional return type\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAIA,kBAAkB;AAC7B;AACA,OAAO,IAAIC,SAAS;AACpB,OAAO,eAAeC,cAAcA,CAACC,EAAE,EAAEC,IAAI,EAAE;EAC3CH,SAAS,GAAGE,EAAE;EACdH,kBAAkB,GAAG;IACjBK,WAAW,EAAE,CAAC,CAAC;IACfC,WAAW,EAAE,CAAC,CAAC;IACfC,UAAU,EAAE,CAAC,CAAC;IACdC,cAAc,EAAE,CAAC,CAAC;IAClBC,mBAAmB,EAAE,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AAE,OAAO;MACbC,KAAK,EAAE;QACHM,OAAO,EAAEC,WAAW,CAACR,IAAI;MAC7B;IACJ,CAAC,GACCQ,WAAW,CAACR,IAAI,CAAC;IACvBS,OAAO,EAAE,EAAE;IACXC,aAAa,EAAEC,SAAS;IACxBC,eAAe,EAAED,SAAS;IAC1BP,aAAa,EAAEA,aAAa;IAC5BS,gBAAgB,EAAE,IAAI;IACtBC,UAAU,EAAEH,SAAS;IACrBN,WAAW,EAAEA,WAAW,IAAI,EAAE;IAC9BpC,SAAS,EAAEA;EACf,CAAC;AACL;AACA,SAASuC,WAAWA,CAACR,IAAI,EAAE;EACvB,QAAQA,IAAI;IACR,KAAK,SAAS;MACV,OAAO;QAAEA,IAAI;QAAE,CAACA,IAAI,GAAG;UAAEe,WAAW,EAAE;QAAY;MAAE,CAAC;IACzD,KAAK,UAAU;MACX,OAAO;QAAEf,IAAI,EAAE,SAAS;QAAEgB,OAAO,EAAE,CAAC;MAAE,CAAC;IAC3C,KAAK,SAAS;MACV,OAAO;QAAEhB,IAAI;QAAE,CAACA,IAAI,GAAG;UAAEiB,SAAS,EAAEN,SAAS;UAAEO,KAAK,EAAEP;QAAU;MAAE,CAAC;IACvE,KAAK,QAAQ;MACT,OAAO;QACHX,IAAI;QACJ,CAACA,IAAI,GAAG;UACJmB,gBAAgB,EAAER,SAAS;UAC3BS,kBAAkB,EAAET,SAAS;UAC7BU,UAAU,EAAE,KAAK;UACjBC,qBAAqB,EAAE;QAC3B;MACJ,CAAC;IACL;MACI;MACA,OAAOC,oBAAoB,CAACvB,IAAI,CAAC;EACzC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASuB,oBAAoBA,CAACvB,IAAI,EAAE;EAChC,OAAO;IAAEA,IAAI;IAAE,CAACA,IAAI,GAAG,CAAC;EAAE,CAAC,CAAC,CAAC;AACjC","ignoreList":[]}
1
+ {"version":3,"file":"defineOntology.js","names":["ontologyDefinition","namespace","defineOntology","ns","body","actionTypes","objectTypes","queryTypes","interfaceTypes","sharedPropertyTypes","valueTypes","e","console","error","ontology","convertToWireOntologyIr","valueType","convertOntologyToValueTypeIr","Object","values","map","definitions","metadata","apiName","displayMetadata","status","versions","definition","version","baseType","constraints","exampleValues","fromEntries","entries","spt","sharedPropertyType","convertSpt","interfaceType","convertInterface","blockPermissionInformation","linkTypes","properties","allExtendsInterfaces","allLinks","allProperties","dumpOntologyFullMetadata","dumpValueTypeWireType","type","array","description","displayName","gothamMapping","typeClasses","visibility","subtype","convertType","aliases","baseFormatter","undefined","dataConstraints","indexedForSearch","provenance","markingType","geohash","precision","scale","analyzerOverride","enableAsciiFolding","isLongText","supportsExactMatching","mediaReference","distributeTypeHelper"],"sources":["defineOntology.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/** @internal */\nexport let ontologyDefinition;\n/** @internal */\nexport let namespace;\nexport async function defineOntology(ns, body) {\n namespace = ns;\n ontologyDefinition = {\n actionTypes: {},\n objectTypes: {},\n queryTypes: {},\n interfaceTypes: {},\n sharedPropertyTypes: {},\n valueTypes: {},\n };\n try {\n await body();\n }\n catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected error while processing the body of the ontology\", e);\n throw e;\n }\n return {\n ontology: convertToWireOntologyIr(ontologyDefinition),\n valueType: convertOntologyToValueTypeIr(ontologyDefinition),\n };\n}\nfunction convertOntologyToValueTypeIr(ontology) {\n return {\n valueTypes: Object.values(ontology.valueTypes).map(definitions => ({\n metadata: {\n apiName: definitions[0].apiName,\n displayMetadata: definitions[0].displayMetadata,\n status: definitions[0].status,\n },\n versions: definitions.map(definition => ({\n version: definition.version,\n baseType: definition.baseType,\n constraints: definition.constraints,\n exampleValues: definition.exampleValues,\n })),\n })),\n };\n}\nfunction convertToWireOntologyIr(ontology) {\n return {\n sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes)\n .map(([apiName, spt]) => [apiName, { sharedPropertyType: convertSpt(spt) }])),\n interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes)\n .map(([apiName, interfaceType]) => {\n return [apiName, {\n interfaceType: convertInterface(interfaceType),\n }];\n })),\n blockPermissionInformation: {\n actionTypes: {},\n linkTypes: {},\n objectTypes: {},\n },\n };\n}\nfunction convertInterface(interfaceType) {\n return {\n ...interfaceType,\n properties: Object.values(interfaceType.properties)\n .map((spt) => convertSpt(spt)),\n // these are omitted from our internal types but we need to re-add them for the final json\n allExtendsInterfaces: [],\n allLinks: [],\n allProperties: [],\n };\n}\nexport function dumpOntologyFullMetadata() {\n return convertToWireOntologyIr(ontologyDefinition);\n}\nexport function dumpValueTypeWireType() {\n return convertOntologyToValueTypeIr(ontologyDefinition);\n}\nfunction convertSpt({ type, array, description, apiName, displayName, gothamMapping, typeClasses, valueType, }) {\n return {\n apiName,\n displayMetadata: {\n displayName: displayName ?? apiName,\n visibility: \"NORMAL\",\n description,\n },\n type: array\n ? {\n type: \"array\",\n array: {\n subtype: convertType(type),\n },\n }\n : convertType(type),\n aliases: [],\n baseFormatter: undefined,\n dataConstraints: undefined,\n gothamMapping: gothamMapping,\n indexedForSearch: true,\n provenance: undefined,\n typeClasses: typeClasses ?? [],\n valueType: valueType,\n };\n}\nfunction convertType(type) {\n switch (type) {\n case \"marking\":\n return { type, [type]: { markingType: \"MANDATORY\" } };\n case \"geopoint\":\n return { type: \"geohash\", geohash: {} };\n case \"decimal\":\n return { type, [type]: { precision: undefined, scale: undefined } };\n case \"string\":\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsExactMatching: true,\n },\n };\n case \"mediaReference\":\n return {\n type: type,\n mediaReference: {},\n };\n default:\n // use helper function to distribute `type` properly\n return distributeTypeHelper(type);\n }\n}\n/**\n * Helper function to avoid duplication. Makes the types match properly with the correct\n * behavior without needing to switch on type.\n * @param type\n * @returns\n */\nfunction distributeTypeHelper(type) {\n return { type, [type]: {} }; // any cast to match conditional return type\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAIA,kBAAkB;AAC7B;AACA,OAAO,IAAIC,SAAS;AACpB,OAAO,eAAeC,cAAcA,CAACC,EAAE,EAAEC,IAAI,EAAE;EAC3CH,SAAS,GAAGE,EAAE;EACdH,kBAAkB,GAAG;IACjBK,WAAW,EAAE,CAAC,CAAC;IACfC,WAAW,EAAE,CAAC,CAAC;IACfC,UAAU,EAAE,CAAC,CAAC;IACdC,cAAc,EAAE,CAAC,CAAC;IAClBC,mBAAmB,EAAE,CAAC,CAAC;IACvBC,UAAU,EAAE,CAAC;EACjB,CAAC;EACD,IAAI;IACA,MAAMN,IAAI,CAAC,CAAC;EAChB,CAAC,CACD,OAAOO,CAAC,EAAE;IACN;IACAC,OAAO,CAACC,KAAK,CAAC,4DAA4D,EAAEF,CAAC,CAAC;IAC9E,MAAMA,CAAC;EACX;EACA,OAAO;IACHG,QAAQ,EAAEC,uBAAuB,CAACf,kBAAkB,CAAC;IACrDgB,SAAS,EAAEC,4BAA4B,CAACjB,kBAAkB;EAC9D,CAAC;AACL;AACA,SAASiB,4BAA4BA,CAACH,QAAQ,EAAE;EAC5C,OAAO;IACHJ,UAAU,EAAEQ,MAAM,CAACC,MAAM,CAACL,QAAQ,CAACJ,UAAU,CAAC,CAACU,GAAG,CAACC,WAAW,KAAK;MAC/DC,QAAQ,EAAE;QACNC,OAAO,EAAEF,WAAW,CAAC,CAAC,CAAC,CAACE,OAAO;QAC/BC,eAAe,EAA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C;MAAE,CAAC;IAC3C,KAAK,SAAS;MACV,OAAO;QAAEhB,IAAI;QAAE,CAACA,IAAI,GAAG;UAAEiB,SAAS,EAAEN,SAAS;UAAEO,KAAK,EAAEP;QAAU;MAAE,CAAC;IACvE,KAAK,QAAQ;MACT,OAAO;QACHX,IAAI;QACJ,CAACA,IAAI,GAAG;UACJmB,gBAAgB,EAAER,SAAS;UAC3BS,kBAAkB,EAAET,SAAS;UAC7BU,UAAU,EAAE,KAAK;UACjBC,qBAAqB,EAAE;QAC3B;MACJ,CAAC;IACL,KAAK,gBAAgB;MACjB,OAAO;QACHtB,IAAI,EAAEA,IAAI;QACVuB,cAAc,EAAE,CAAC;MACrB,CAAC;IACL;MACI;MACA,OAAOC,oBAAoB,CAACxB,IAAI,CAAC;EACzC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASwB,oBAAoBA,CAACxB,IAAI,EAAE;EAChC,OAAO;IAAEA,IAAI;IAAE,CAACA,IAAI,GAAG,CAAC;EAAE,CAAC,CAAC,CAAC;AACjC","ignoreList":[]}
@@ -312,6 +312,430 @@ describe("Ontology Defining", () => {
312
312
  }).toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Shared property type com.palantir.foo already exists]`);
313
313
  });
314
314
  });
315
+ it("allows extends interfaces with InterfaceType provided", () => {
316
+ const parentInterface = defineInterface({
317
+ apiName: "parentInterface",
318
+ properties: {
319
+ property1: "string"
320
+ }
321
+ });
322
+ defineInterface({
323
+ apiName: "childInterface",
324
+ properties: {
325
+ property2: "string"
326
+ },
327
+ extends: [parentInterface]
328
+ });
329
+ expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
330
+ {
331
+ "blockPermissionInformation": {
332
+ "actionTypes": {},
333
+ "linkTypes": {},
334
+ "objectTypes": {},
335
+ },
336
+ "interfaceTypes": {
337
+ "com.palantir.childInterface": {
338
+ "interfaceType": {
339
+ "allExtendsInterfaces": [],
340
+ "allLinks": [],
341
+ "allProperties": [],
342
+ "apiName": "com.palantir.childInterface",
343
+ "displayMetadata": {
344
+ "description": "childInterface",
345
+ "displayName": "childInterface",
346
+ "icon": undefined,
347
+ },
348
+ "extendsInterfaces": [
349
+ "com.palantir.parentInterface",
350
+ ],
351
+ "links": [],
352
+ "properties": [
353
+ {
354
+ "aliases": [],
355
+ "apiName": "com.palantir.property2",
356
+ "baseFormatter": undefined,
357
+ "dataConstraints": undefined,
358
+ "displayMetadata": {
359
+ "description": undefined,
360
+ "displayName": "property2",
361
+ "visibility": "NORMAL",
362
+ },
363
+ "gothamMapping": undefined,
364
+ "indexedForSearch": true,
365
+ "provenance": undefined,
366
+ "type": {
367
+ "string": {
368
+ "analyzerOverride": undefined,
369
+ "enableAsciiFolding": undefined,
370
+ "isLongText": false,
371
+ "supportsExactMatching": true,
372
+ },
373
+ "type": "string",
374
+ },
375
+ "typeClasses": [
376
+ {
377
+ "kind": "render_hint",
378
+ "name": "SELECTABLE",
379
+ },
380
+ {
381
+ "kind": "render_hint",
382
+ "name": "SORTABLE",
383
+ },
384
+ ],
385
+ "valueType": undefined,
386
+ },
387
+ ],
388
+ "status": {
389
+ "active": {},
390
+ "type": "active",
391
+ },
392
+ },
393
+ },
394
+ "com.palantir.parentInterface": {
395
+ "interfaceType": {
396
+ "allExtendsInterfaces": [],
397
+ "allLinks": [],
398
+ "allProperties": [],
399
+ "apiName": "com.palantir.parentInterface",
400
+ "displayMetadata": {
401
+ "description": "parentInterface",
402
+ "displayName": "parentInterface",
403
+ "icon": undefined,
404
+ },
405
+ "extendsInterfaces": [],
406
+ "links": [],
407
+ "properties": [
408
+ {
409
+ "aliases": [],
410
+ "apiName": "com.palantir.property1",
411
+ "baseFormatter": undefined,
412
+ "dataConstraints": undefined,
413
+ "displayMetadata": {
414
+ "description": undefined,
415
+ "displayName": "property1",
416
+ "visibility": "NORMAL",
417
+ },
418
+ "gothamMapping": undefined,
419
+ "indexedForSearch": true,
420
+ "provenance": undefined,
421
+ "type": {
422
+ "string": {
423
+ "analyzerOverride": undefined,
424
+ "enableAsciiFolding": undefined,
425
+ "isLongText": false,
426
+ "supportsExactMatching": true,
427
+ },
428
+ "type": "string",
429
+ },
430
+ "typeClasses": [
431
+ {
432
+ "kind": "render_hint",
433
+ "name": "SELECTABLE",
434
+ },
435
+ {
436
+ "kind": "render_hint",
437
+ "name": "SORTABLE",
438
+ },
439
+ ],
440
+ "valueType": undefined,
441
+ },
442
+ ],
443
+ "status": {
444
+ "active": {},
445
+ "type": "active",
446
+ },
447
+ },
448
+ },
449
+ },
450
+ "sharedPropertyTypes": {
451
+ "com.palantir.property1": {
452
+ "sharedPropertyType": {
453
+ "aliases": [],
454
+ "apiName": "com.palantir.property1",
455
+ "baseFormatter": undefined,
456
+ "dataConstraints": undefined,
457
+ "displayMetadata": {
458
+ "description": undefined,
459
+ "displayName": "property1",
460
+ "visibility": "NORMAL",
461
+ },
462
+ "gothamMapping": undefined,
463
+ "indexedForSearch": true,
464
+ "provenance": undefined,
465
+ "type": {
466
+ "string": {
467
+ "analyzerOverride": undefined,
468
+ "enableAsciiFolding": undefined,
469
+ "isLongText": false,
470
+ "supportsExactMatching": true,
471
+ },
472
+ "type": "string",
473
+ },
474
+ "typeClasses": [
475
+ {
476
+ "kind": "render_hint",
477
+ "name": "SELECTABLE",
478
+ },
479
+ {
480
+ "kind": "render_hint",
481
+ "name": "SORTABLE",
482
+ },
483
+ ],
484
+ "valueType": undefined,
485
+ },
486
+ },
487
+ "com.palantir.property2": {
488
+ "sharedPropertyType": {
489
+ "aliases": [],
490
+ "apiName": "com.palantir.property2",
491
+ "baseFormatter": undefined,
492
+ "dataConstraints": undefined,
493
+ "displayMetadata": {
494
+ "description": undefined,
495
+ "displayName": "property2",
496
+ "visibility": "NORMAL",
497
+ },
498
+ "gothamMapping": undefined,
499
+ "indexedForSearch": true,
500
+ "provenance": undefined,
501
+ "type": {
502
+ "string": {
503
+ "analyzerOverride": undefined,
504
+ "enableAsciiFolding": undefined,
505
+ "isLongText": false,
506
+ "supportsExactMatching": true,
507
+ },
508
+ "type": "string",
509
+ },
510
+ "typeClasses": [
511
+ {
512
+ "kind": "render_hint",
513
+ "name": "SELECTABLE",
514
+ },
515
+ {
516
+ "kind": "render_hint",
517
+ "name": "SORTABLE",
518
+ },
519
+ ],
520
+ "valueType": undefined,
521
+ },
522
+ },
523
+ },
524
+ }
525
+ `);
526
+ });
527
+ it("allows extends interfaces with apiName provided", () => {
528
+ defineInterface({
529
+ apiName: "parentInterface",
530
+ properties: {
531
+ property1: "string"
532
+ }
533
+ });
534
+ defineInterface({
535
+ apiName: "childInterface",
536
+ properties: {
537
+ property2: "string"
538
+ },
539
+ extends: ["parentInterface"]
540
+ });
541
+ expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`
542
+ {
543
+ "blockPermissionInformation": {
544
+ "actionTypes": {},
545
+ "linkTypes": {},
546
+ "objectTypes": {},
547
+ },
548
+ "interfaceTypes": {
549
+ "com.palantir.childInterface": {
550
+ "interfaceType": {
551
+ "allExtendsInterfaces": [],
552
+ "allLinks": [],
553
+ "allProperties": [],
554
+ "apiName": "com.palantir.childInterface",
555
+ "displayMetadata": {
556
+ "description": "childInterface",
557
+ "displayName": "childInterface",
558
+ "icon": undefined,
559
+ },
560
+ "extendsInterfaces": [
561
+ "parentInterface",
562
+ ],
563
+ "links": [],
564
+ "properties": [
565
+ {
566
+ "aliases": [],
567
+ "apiName": "com.palantir.property2",
568
+ "baseFormatter": undefined,
569
+ "dataConstraints": undefined,
570
+ "displayMetadata": {
571
+ "description": undefined,
572
+ "displayName": "property2",
573
+ "visibility": "NORMAL",
574
+ },
575
+ "gothamMapping": undefined,
576
+ "indexedForSearch": true,
577
+ "provenance": undefined,
578
+ "type": {
579
+ "string": {
580
+ "analyzerOverride": undefined,
581
+ "enableAsciiFolding": undefined,
582
+ "isLongText": false,
583
+ "supportsExactMatching": true,
584
+ },
585
+ "type": "string",
586
+ },
587
+ "typeClasses": [
588
+ {
589
+ "kind": "render_hint",
590
+ "name": "SELECTABLE",
591
+ },
592
+ {
593
+ "kind": "render_hint",
594
+ "name": "SORTABLE",
595
+ },
596
+ ],
597
+ "valueType": undefined,
598
+ },
599
+ ],
600
+ "status": {
601
+ "active": {},
602
+ "type": "active",
603
+ },
604
+ },
605
+ },
606
+ "com.palantir.parentInterface": {
607
+ "interfaceType": {
608
+ "allExtendsInterfaces": [],
609
+ "allLinks": [],
610
+ "allProperties": [],
611
+ "apiName": "com.palantir.parentInterface",
612
+ "displayMetadata": {
613
+ "description": "parentInterface",
614
+ "displayName": "parentInterface",
615
+ "icon": undefined,
616
+ },
617
+ "extendsInterfaces": [],
618
+ "links": [],
619
+ "properties": [
620
+ {
621
+ "aliases": [],
622
+ "apiName": "com.palantir.property1",
623
+ "baseFormatter": undefined,
624
+ "dataConstraints": undefined,
625
+ "displayMetadata": {
626
+ "description": undefined,
627
+ "displayName": "property1",
628
+ "visibility": "NORMAL",
629
+ },
630
+ "gothamMapping": undefined,
631
+ "indexedForSearch": true,
632
+ "provenance": undefined,
633
+ "type": {
634
+ "string": {
635
+ "analyzerOverride": undefined,
636
+ "enableAsciiFolding": undefined,
637
+ "isLongText": false,
638
+ "supportsExactMatching": true,
639
+ },
640
+ "type": "string",
641
+ },
642
+ "typeClasses": [
643
+ {
644
+ "kind": "render_hint",
645
+ "name": "SELECTABLE",
646
+ },
647
+ {
648
+ "kind": "render_hint",
649
+ "name": "SORTABLE",
650
+ },
651
+ ],
652
+ "valueType": undefined,
653
+ },
654
+ ],
655
+ "status": {
656
+ "active": {},
657
+ "type": "active",
658
+ },
659
+ },
660
+ },
661
+ },
662
+ "sharedPropertyTypes": {
663
+ "com.palantir.property1": {
664
+ "sharedPropertyType": {
665
+ "aliases": [],
666
+ "apiName": "com.palantir.property1",
667
+ "baseFormatter": undefined,
668
+ "dataConstraints": undefined,
669
+ "displayMetadata": {
670
+ "description": undefined,
671
+ "displayName": "property1",
672
+ "visibility": "NORMAL",
673
+ },
674
+ "gothamMapping": undefined,
675
+ "indexedForSearch": true,
676
+ "provenance": undefined,
677
+ "type": {
678
+ "string": {
679
+ "analyzerOverride": undefined,
680
+ "enableAsciiFolding": undefined,
681
+ "isLongText": false,
682
+ "supportsExactMatching": true,
683
+ },
684
+ "type": "string",
685
+ },
686
+ "typeClasses": [
687
+ {
688
+ "kind": "render_hint",
689
+ "name": "SELECTABLE",
690
+ },
691
+ {
692
+ "kind": "render_hint",
693
+ "name": "SORTABLE",
694
+ },
695
+ ],
696
+ "valueType": undefined,
697
+ },
698
+ },
699
+ "com.palantir.property2": {
700
+ "sharedPropertyType": {
701
+ "aliases": [],
702
+ "apiName": "com.palantir.property2",
703
+ "baseFormatter": undefined,
704
+ "dataConstraints": undefined,
705
+ "displayMetadata": {
706
+ "description": undefined,
707
+ "displayName": "property2",
708
+ "visibility": "NORMAL",
709
+ },
710
+ "gothamMapping": undefined,
711
+ "indexedForSearch": true,
712
+ "provenance": undefined,
713
+ "type": {
714
+ "string": {
715
+ "analyzerOverride": undefined,
716
+ "enableAsciiFolding": undefined,
717
+ "isLongText": false,
718
+ "supportsExactMatching": true,
719
+ },
720
+ "type": "string",
721
+ },
722
+ "typeClasses": [
723
+ {
724
+ "kind": "render_hint",
725
+ "name": "SELECTABLE",
726
+ },
727
+ {
728
+ "kind": "render_hint",
729
+ "name": "SORTABLE",
730
+ },
731
+ ],
732
+ "valueType": undefined,
733
+ },
734
+ },
735
+ },
736
+ }
737
+ `);
738
+ });
315
739
  });
316
740
  describe("ILTs", () => {
317
741
  let a;