@osdk/maker 0.9.0-beta.3 → 0.9.0-beta.30
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 +258 -0
- package/build/browser/api/defineImportSpt.js +47 -0
- package/build/browser/api/defineImportSpt.js.map +1 -0
- package/build/browser/api/defineInterface.js +39 -11
- package/build/browser/api/defineInterface.js.map +1 -1
- package/build/browser/api/defineInterfaceLinkConstraint.js +3 -2
- package/build/browser/api/defineInterfaceLinkConstraint.js.map +1 -1
- package/build/browser/api/defineObject.js +57 -62
- package/build/browser/api/defineObject.js.map +1 -1
- package/build/browser/api/defineOntology.js +194 -23
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/defineSpt.js +3 -1
- package/build/browser/api/defineSpt.js.map +1 -1
- package/build/browser/api/defineValueType.js +58 -11
- package/build/browser/api/defineValueType.js.map +1 -1
- package/build/browser/api/iconNames.js +0 -15
- package/build/browser/api/iconNames.js.map +1 -1
- package/build/browser/api/overall.test.js +704 -63
- package/build/browser/api/overall.test.js.map +1 -1
- package/build/browser/api/types.js +0 -15
- package/build/browser/api/types.js.map +1 -1
- package/build/browser/cli/main.js +5 -6
- package/build/browser/cli/main.js.map +1 -1
- package/build/browser/index.js +3 -0
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +716 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +343 -0
- package/build/esm/api/defineImportSpt.js +47 -0
- package/build/esm/api/defineImportSpt.js.map +1 -0
- package/build/esm/api/defineInterface.js +39 -11
- package/build/esm/api/defineInterface.js.map +1 -1
- package/build/esm/api/defineInterfaceLinkConstraint.js +3 -2
- package/build/esm/api/defineInterfaceLinkConstraint.js.map +1 -1
- package/build/esm/api/defineObject.js +57 -62
- package/build/esm/api/defineObject.js.map +1 -1
- package/build/esm/api/defineOntology.js +194 -23
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/defineSpt.js +3 -1
- package/build/esm/api/defineSpt.js.map +1 -1
- package/build/esm/api/defineValueType.js +58 -11
- package/build/esm/api/defineValueType.js.map +1 -1
- package/build/esm/api/iconNames.js +0 -15
- package/build/esm/api/iconNames.js.map +1 -1
- package/build/esm/api/overall.test.js +704 -63
- package/build/esm/api/overall.test.js.map +1 -1
- package/build/esm/api/types.js +0 -15
- package/build/esm/api/types.js.map +1 -1
- package/build/esm/cli/main.js +5 -6
- package/build/esm/cli/main.js.map +1 -1
- package/build/esm/index.js +3 -0
- package/build/esm/index.js.map +1 -1
- package/package.json +28 -13
- package/build/browser/api/defineInterface.d.ts +0 -14
- package/build/browser/api/defineInterface.d.ts.map +0 -1
- package/build/browser/api/defineInterfaceLinkConstraint.d.ts +0 -21
- package/build/browser/api/defineInterfaceLinkConstraint.d.ts.map +0 -1
- package/build/browser/api/defineLink.d.ts +0 -18
- package/build/browser/api/defineLink.d.ts.map +0 -1
- package/build/browser/api/defineLink.js +0 -37
- package/build/browser/api/defineLink.js.map +0 -1
- package/build/browser/api/defineObject.d.ts +0 -15
- package/build/browser/api/defineObject.d.ts.map +0 -1
- package/build/browser/api/defineOntology.d.ts +0 -10
- package/build/browser/api/defineOntology.d.ts.map +0 -1
- package/build/browser/api/defineSpt.d.ts +0 -13
- package/build/browser/api/defineSpt.d.ts.map +0 -1
- package/build/browser/api/defineValueType.d.ts +0 -26
- package/build/browser/api/defineValueType.d.ts.map +0 -1
- package/build/browser/api/iconNames.d.ts +0 -3
- package/build/browser/api/iconNames.d.ts.map +0 -1
- package/build/browser/api/overall.test.d.ts +0 -2
- package/build/browser/api/overall.test.d.ts.map +0 -1
- package/build/browser/api/types.d.ts +0 -38
- package/build/browser/api/types.d.ts.map +0 -1
- package/build/browser/cli/main.d.ts +0 -2
- package/build/browser/cli/main.d.ts.map +0 -1
- package/build/browser/index.d.ts +0 -6
- package/build/browser/index.d.ts.map +0 -1
- package/build/esm/api/defineInterface.d.ts +0 -14
- package/build/esm/api/defineInterface.d.ts.map +0 -1
- package/build/esm/api/defineInterfaceLinkConstraint.d.ts +0 -21
- package/build/esm/api/defineInterfaceLinkConstraint.d.ts.map +0 -1
- package/build/esm/api/defineLink.d.ts +0 -18
- package/build/esm/api/defineLink.d.ts.map +0 -1
- package/build/esm/api/defineLink.js +0 -37
- package/build/esm/api/defineLink.js.map +0 -1
- package/build/esm/api/defineObject.d.ts +0 -15
- package/build/esm/api/defineObject.d.ts.map +0 -1
- package/build/esm/api/defineOntology.d.ts +0 -10
- package/build/esm/api/defineOntology.d.ts.map +0 -1
- package/build/esm/api/defineSpt.d.ts +0 -13
- package/build/esm/api/defineSpt.d.ts.map +0 -1
- package/build/esm/api/defineValueType.d.ts +0 -26
- package/build/esm/api/defineValueType.d.ts.map +0 -1
- package/build/esm/api/iconNames.d.ts +0 -3
- package/build/esm/api/iconNames.d.ts.map +0 -1
- package/build/esm/api/overall.test.d.ts +0 -2
- package/build/esm/api/overall.test.d.ts.map +0 -1
- package/build/esm/api/types.d.ts +0 -38
- package/build/esm/api/types.d.ts.map +0 -1
- package/build/esm/cli/main.d.ts +0 -2
- package/build/esm/cli/main.d.ts.map +0 -1
- package/build/esm/index.d.ts +0 -6
- package/build/esm/index.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineObject.js","names":["invariant","ontologyDefinition","defineObject","apiName","
|
|
1
|
+
{"version":3,"file":"defineObject.js","names":["invariant","namespace","ontologyDefinition","defineObject","objectDef","apiName","propertyApiNames","properties","map","val","objectTypes","undefined","Error","includes","titlePropertyApiName","process","env","NODE_ENV","primaryKeys","length","nonExistentPrimaryKeys","filter","primaryKey","implementsInterfaces","forEach","interfaceImpl","nonExistentInterfaceProperties","propertyMapping","interfaceProperty","implements","interfaceProp","type","reason","interfaceToObjectProperties","Object","fromEntries","mapping","mapsTo","validateProperty","nonNameSpacedApiName","validateInterfaceImplProperty","baseValidations","entries","extendsValidations","extendsInterfaces","flatMap","interfaceApiName","interfaceTypes","allFailedValidations","concat","formatValidationErrors","join","error","spt","mappedObjectProp","object","objProp","find","prop"],"sources":["defineObject.ts"],"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\nimport invariant from \"tiny-invariant\";\nimport { namespace, ontologyDefinition } from \"./defineOntology.js\";\nimport type { ObjectType, SharedPropertyType } from \"./types.js\";\n\nexport function defineObject(objectDef: ObjectType): ObjectType {\n const apiName = namespace + objectDef.apiName;\n const propertyApiNames = (objectDef.properties ?? []).map(val => val.apiName);\n if (ontologyDefinition.objectTypes[apiName] !== undefined) {\n throw new Error(\n `Object type with apiName ${objectDef.apiName} is already defined`,\n );\n }\n invariant(\n propertyApiNames.includes(objectDef.titlePropertyApiName),\n `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`,\n );\n invariant(\n objectDef.primaryKeys.length !== 0,\n `${objectDef.apiName} does not have any primary keys, objects must have at least one primary key`,\n );\n const nonExistentPrimaryKeys = objectDef.primaryKeys.filter(primaryKey =>\n !objectDef.properties?.map(val => val.apiName).includes(primaryKey)\n );\n invariant(\n nonExistentPrimaryKeys.length === 0,\n `Primary key properties ${nonExistentPrimaryKeys} do not exist on object ${objectDef.apiName}`,\n );\n\n objectDef.implementsInterfaces?.forEach(interfaceImpl => {\n const nonExistentInterfaceProperties: ValidationResult[] = interfaceImpl\n .propertyMapping.map(val => val.interfaceProperty).filter(\n interfaceProperty =>\n interfaceImpl.implements.properties[interfaceProperty] === undefined,\n ).map(interfaceProp => ({\n type: \"invalid\",\n reason:\n `Interface property ${interfaceImpl.implements.apiName}.${interfaceProp} referenced in ${objectDef.apiName} object does not exist`,\n }));\n\n const interfaceToObjectProperties = Object.fromEntries(\n interfaceImpl.propertyMapping.map(\n mapping => [mapping.interfaceProperty, mapping.mapsTo],\n ),\n );\n const validateProperty = (\n interfaceProp: [string, SharedPropertyType],\n ): ValidationResult => {\n if (\n interfaceProp[1].nonNameSpacedApiName in interfaceToObjectProperties\n ) {\n return validateInterfaceImplProperty(\n interfaceProp[1],\n interfaceToObjectProperties[interfaceProp[0]],\n objectDef,\n );\n }\n return {\n type: \"invalid\",\n reason: `Interface property ${interfaceImpl.implements.apiName}.${\n interfaceProp[1].nonNameSpacedApiName\n } not implemented by ${objectDef.apiName} object definition`,\n };\n };\n const baseValidations = Object.entries(interfaceImpl.implements.properties)\n .map<ValidationResult>(validateProperty);\n const extendsValidations = interfaceImpl.implements.extendsInterfaces\n .flatMap(interfaceApiName =>\n Object.entries(\n ontologyDefinition.interfaceTypes[interfaceApiName].properties,\n ).map(validateProperty)\n );\n\n const allFailedValidations = baseValidations.concat(\n extendsValidations,\n nonExistentInterfaceProperties,\n ).filter(val => val.type === \"invalid\");\n invariant(\n allFailedValidations.length === 0,\n \"\\n\" + allFailedValidations.map(formatValidationErrors).join(\"\\n\"),\n );\n });\n\n ontologyDefinition.objectTypes[apiName] = { ...objectDef, apiName: apiName };\n return { ...objectDef, apiName: apiName };\n}\n\ntype ValidationResult = { type: \"valid\" } | { type: \"invalid\"; reason: string };\n\nfunction formatValidationErrors(\n error: { type: \"invalid\"; reason: string },\n): string {\n return `Ontology Definition Error: ${error.reason}\\n`;\n}\n\n// Validate that the object and the interface property match up\nfunction validateInterfaceImplProperty(\n spt: SharedPropertyType,\n mappedObjectProp: string,\n object: ObjectType,\n): ValidationResult {\n const objProp = object.properties?.find(prop =>\n prop.apiName === mappedObjectProp\n );\n if (objProp === undefined) {\n return {\n type: \"invalid\",\n reason:\n `Object property mapped to interface does not exist. Object Property Mapped: ${mappedObjectProp}`,\n };\n }\n if (spt.type !== objProp?.type) {\n return {\n type: \"invalid\",\n reason:\n `Object property type does not match the interface property it is mapped to. Interface Property: ${spt.apiName}, objectProperty: ${mappedObjectProp}`,\n };\n }\n\n return { type: \"valid\" };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,qBAAqB;AAGnE,OAAO,SAASC,YAAYA,CAACC,SAAqB,EAAc;EAC9D,MAAMC,OAAO,GAAGJ,SAAS,GAAGG,SAAS,CAACC,OAAO;EAC7C,MAAMC,gBAAgB,GAAG,CAACF,SAAS,CAACG,UAAU,IAAI,EAAE,EAAEC,GAAG,CAACC,GAAG,IAAIA,GAAG,CAACJ,OAAO,CAAC;EAC7E,IAAIH,kBAAkB,CAACQ,WAAW,CAACL,OAAO,CAAC,KAAKM,SAAS,EAAE;IACzD,MAAM,IAAIC,KAAK,CACb,4BAA4BR,SAAS,CAACC,OAAO,qBAC/C,CAAC;EACH;EACA,CACEC,gBAAgB,CAACO,QAAQ,CAACT,SAAS,CAACU,oBAAoB,CAAC,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAD3DjB,SAAS,QAEP,kBAAkBI,SAAS,CAACU,oBAAoB,6BAA6BV,SAAS,CAACC,OAAO,EAAE,IAFlGL,SAAS;EAIT,EACEI,SAAS,CAACc,WAAW,CAACC,MAAM,KAAK,CAAC,IAAAJ,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADpCjB,SAAS,QAEP,GAAGI,SAAS,CAACC,OAAO,6EAA6E,IAFnGL,SAAS;EAIT,MAAMoB,sBAAsB,GAAGhB,SAAS,CAACc,WAAW,CAACG,MAAM,CAACC,UAAU,IACpE,CAAClB,SAAS,CAACG,UAAU,EAAEC,GAAG,CAACC,GAAG,IAAIA,GAAG,CAACJ,OAAO,CAAC,CAACQ,QAAQ,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rD,OAAO,KAAKiD,gBACnB,CAAC;EACD,IAAIE,OAAO,KAAK7C,SAAS,EAAE;IACzB,OAAO;MACLoB,IAAI,EAAE,SAAS;MACfC,MAAM,EACJ,+EAA+EsB,gBAAgB;IACnG,CAAC;EACH;EACA,IAAID,GAAG,CAACtB,IAAI,KAAKyB,OAAO,EAAEzB,IAAI,EAAE;IAC9B,OAAO;MACLA,IAAI,EAAE,SAAS;MACfC,MAAM,EACJ,mGAAmGqB,GAAG,CAAChD,OAAO,qBAAqBiD,gBAAgB;IACvJ,CAAC;EACH;EAEA,OAAO;IAAEvB,IAAI,EAAE;EAAQ,CAAC;AAC1B","ignoreList":[]}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
/*
|
|
2
18
|
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
19
|
*
|
|
@@ -13,8 +29,10 @@
|
|
|
13
29
|
* See the License for the specific language governing permissions and
|
|
14
30
|
* limitations under the License.
|
|
15
31
|
*/
|
|
32
|
+
|
|
16
33
|
/** @internal */
|
|
17
34
|
export let ontologyDefinition;
|
|
35
|
+
|
|
18
36
|
/** @internal */
|
|
19
37
|
export let namespace;
|
|
20
38
|
export async function defineOntology(ns, body) {
|
|
@@ -25,7 +43,10 @@ export async function defineOntology(ns, body) {
|
|
|
25
43
|
queryTypes: {},
|
|
26
44
|
interfaceTypes: {},
|
|
27
45
|
sharedPropertyTypes: {},
|
|
28
|
-
valueTypes: {}
|
|
46
|
+
valueTypes: {},
|
|
47
|
+
importedTypes: {
|
|
48
|
+
sharedPropertyTypes: []
|
|
49
|
+
}
|
|
29
50
|
};
|
|
30
51
|
try {
|
|
31
52
|
await body();
|
|
@@ -58,21 +79,114 @@ function convertOntologyToValueTypeIr(ontology) {
|
|
|
58
79
|
}
|
|
59
80
|
function convertToWireOntologyIr(ontology) {
|
|
60
81
|
return {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}]
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
blockData: {
|
|
83
|
+
objectTypes: Object.fromEntries(Object.entries(ontology.objectTypes).map(([apiName, objectType]) => {
|
|
84
|
+
return [apiName, convertObject(objectType)];
|
|
85
|
+
})),
|
|
86
|
+
sharedPropertyTypes: Object.fromEntries(Object.entries(ontology.sharedPropertyTypes).map(([apiName, spt]) => [apiName, {
|
|
87
|
+
sharedPropertyType: convertSpt(spt)
|
|
88
|
+
}])),
|
|
89
|
+
interfaceTypes: Object.fromEntries(Object.entries(ontology.interfaceTypes).map(([apiName, interfaceType]) => {
|
|
90
|
+
return [apiName, {
|
|
91
|
+
interfaceType: convertInterface(interfaceType)
|
|
92
|
+
}];
|
|
93
|
+
})),
|
|
94
|
+
blockPermissionInformation: {
|
|
95
|
+
actionTypes: {},
|
|
96
|
+
linkTypes: {},
|
|
97
|
+
objectTypes: {}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
importedTypes: ontology.importedTypes
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function convertObject(objectType) {
|
|
104
|
+
const propertyDatasource = {};
|
|
105
|
+
(objectType.properties ?? []).forEach(property => {
|
|
106
|
+
propertyDatasource[property.apiName] = {
|
|
107
|
+
type: "column",
|
|
108
|
+
column: property.apiName
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
const datasource = {
|
|
112
|
+
rid: "ri.ontology.main.datasource.".concat(objectType.apiName),
|
|
113
|
+
datasource: {
|
|
114
|
+
type: "datasetV2",
|
|
115
|
+
datasetV2: {
|
|
116
|
+
datasetRid: objectType.apiName,
|
|
117
|
+
propertyMapping: propertyDatasource
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
editsConfiguration: {
|
|
121
|
+
onlyAllowPrivilegedEdits: false
|
|
122
|
+
},
|
|
123
|
+
redacted: false
|
|
124
|
+
};
|
|
125
|
+
const implementations = objectType.implementsInterfaces ?? [];
|
|
126
|
+
return {
|
|
127
|
+
objectType: {
|
|
128
|
+
displayMetadata: {
|
|
129
|
+
description: objectType.description,
|
|
130
|
+
displayName: objectType.displayName,
|
|
131
|
+
groupDisplayName: undefined,
|
|
132
|
+
icon: {
|
|
133
|
+
type: "blueprint",
|
|
134
|
+
blueprint: objectType.icon ?? {
|
|
135
|
+
locator: "cube",
|
|
136
|
+
color: "#2D72D2"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
pluralDisplayName: objectType.pluralDisplayName,
|
|
140
|
+
visibility: objectType.visibility ?? "NORMAL"
|
|
141
|
+
},
|
|
142
|
+
primaryKeys: objectType.primaryKeys,
|
|
143
|
+
propertyTypes: Object.fromEntries(objectType.properties?.map(val => [val.apiName, convertProperty(val)]) ?? []),
|
|
144
|
+
titlePropertyTypeRid: objectType.titlePropertyApiName,
|
|
145
|
+
apiName: objectType.apiName,
|
|
146
|
+
status: objectType.status ?? {
|
|
147
|
+
type: "active",
|
|
148
|
+
active: {}
|
|
149
|
+
},
|
|
150
|
+
redacted: false,
|
|
151
|
+
implementsInterfaces2: implementations.map(impl => ({
|
|
152
|
+
interfaceTypeApiName: impl.implements.apiName,
|
|
153
|
+
properties: Object.fromEntries(impl.propertyMapping.map(mapping => [namespace + mapping.interfaceProperty, {
|
|
154
|
+
propertyTypeRid: mapping.mapsTo
|
|
155
|
+
}]))
|
|
156
|
+
})),
|
|
157
|
+
allImplementsInterfaces: {}
|
|
158
|
+
},
|
|
159
|
+
datasources: [datasource],
|
|
160
|
+
entityMetadata: {
|
|
161
|
+
arePatchesEnabled: objectType.editsEnabled ?? false
|
|
73
162
|
}
|
|
74
163
|
};
|
|
75
164
|
}
|
|
165
|
+
function convertProperty(property) {
|
|
166
|
+
const output = {
|
|
167
|
+
apiName: property.apiName,
|
|
168
|
+
sharedPropertyTypeApiName: property.sharedPropertyType?.apiName,
|
|
169
|
+
displayMetadata: {
|
|
170
|
+
displayName: property.displayName,
|
|
171
|
+
description: property.description,
|
|
172
|
+
visibility: property.visibility ?? "NORMAL"
|
|
173
|
+
},
|
|
174
|
+
indexedForSearch: property.indexedForSearch ?? true,
|
|
175
|
+
ruleSetBinding: undefined,
|
|
176
|
+
baseFormatter: property.baseFormatter,
|
|
177
|
+
type: convertType(property.type),
|
|
178
|
+
typeClasses: property.typeClasses ?? [],
|
|
179
|
+
status: property.status ?? {
|
|
180
|
+
type: "active",
|
|
181
|
+
active: {}
|
|
182
|
+
},
|
|
183
|
+
inlineAction: undefined,
|
|
184
|
+
dataConstraints: property.dataConstraints,
|
|
185
|
+
sharedPropertyTypeRid: property.sharedPropertyType?.apiName,
|
|
186
|
+
valueType: undefined
|
|
187
|
+
};
|
|
188
|
+
return output;
|
|
189
|
+
}
|
|
76
190
|
function convertInterface(interfaceType) {
|
|
77
191
|
return {
|
|
78
192
|
...interfaceType,
|
|
@@ -99,6 +213,14 @@ function convertSpt({
|
|
|
99
213
|
typeClasses,
|
|
100
214
|
valueType
|
|
101
215
|
}) {
|
|
216
|
+
const dataConstraint = typeof type === "object" && type.type === "marking" ? {
|
|
217
|
+
propertyTypeConstraints: [],
|
|
218
|
+
nullability: undefined,
|
|
219
|
+
nullabilityV2: {
|
|
220
|
+
noEmptyCollections: true,
|
|
221
|
+
noNulls: true
|
|
222
|
+
}
|
|
223
|
+
} : undefined;
|
|
102
224
|
return {
|
|
103
225
|
apiName,
|
|
104
226
|
displayMetadata: {
|
|
@@ -114,7 +236,7 @@ function convertSpt({
|
|
|
114
236
|
} : convertType(type),
|
|
115
237
|
aliases: [],
|
|
116
238
|
baseFormatter: undefined,
|
|
117
|
-
dataConstraints:
|
|
239
|
+
dataConstraints: dataConstraint,
|
|
118
240
|
gothamMapping: gothamMapping,
|
|
119
241
|
indexedForSearch: true,
|
|
120
242
|
provenance: undefined,
|
|
@@ -123,20 +245,67 @@ function convertSpt({
|
|
|
123
245
|
};
|
|
124
246
|
}
|
|
125
247
|
function convertType(type) {
|
|
126
|
-
switch (
|
|
127
|
-
case "
|
|
248
|
+
switch (true) {
|
|
249
|
+
case typeof type === "object" && "markingType" in type:
|
|
128
250
|
return {
|
|
129
|
-
type,
|
|
130
|
-
|
|
131
|
-
markingType:
|
|
251
|
+
"type": "marking",
|
|
252
|
+
marking: {
|
|
253
|
+
markingType: type.markingType
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
case typeof type === "object" && "structDefinition" in type:
|
|
257
|
+
const structFields = new Array();
|
|
258
|
+
for (const key in type.structDefinition) {
|
|
259
|
+
const fieldTypeDefinition = type.structDefinition[key];
|
|
260
|
+
let field;
|
|
261
|
+
if (typeof fieldTypeDefinition === "string") {
|
|
262
|
+
field = {
|
|
263
|
+
apiName: key,
|
|
264
|
+
displayMetadata: {
|
|
265
|
+
displayName: key,
|
|
266
|
+
description: undefined
|
|
267
|
+
},
|
|
268
|
+
typeClasses: [],
|
|
269
|
+
aliases: [],
|
|
270
|
+
fieldType: convertType(fieldTypeDefinition)
|
|
271
|
+
};
|
|
272
|
+
} else {
|
|
273
|
+
// If it is a full form type definition then process it as such
|
|
274
|
+
if ("fieldType" in fieldTypeDefinition) {
|
|
275
|
+
field = {
|
|
276
|
+
...fieldTypeDefinition,
|
|
277
|
+
apiName: key,
|
|
278
|
+
fieldType: convertType(fieldTypeDefinition.fieldType),
|
|
279
|
+
typeClasses: fieldTypeDefinition.typeClasses ?? [],
|
|
280
|
+
aliases: fieldTypeDefinition.aliases ?? []
|
|
281
|
+
};
|
|
282
|
+
} else {
|
|
283
|
+
field = {
|
|
284
|
+
apiName: key,
|
|
285
|
+
displayMetadata: {
|
|
286
|
+
displayName: key,
|
|
287
|
+
description: undefined
|
|
288
|
+
},
|
|
289
|
+
typeClasses: [],
|
|
290
|
+
aliases: [],
|
|
291
|
+
fieldType: convertType(fieldTypeDefinition)
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
structFields.push(field);
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
type: "struct",
|
|
299
|
+
struct: {
|
|
300
|
+
structFields
|
|
132
301
|
}
|
|
133
302
|
};
|
|
134
|
-
case "geopoint":
|
|
303
|
+
case type === "geopoint":
|
|
135
304
|
return {
|
|
136
305
|
type: "geohash",
|
|
137
306
|
geohash: {}
|
|
138
307
|
};
|
|
139
|
-
case "decimal":
|
|
308
|
+
case type === "decimal":
|
|
140
309
|
return {
|
|
141
310
|
type,
|
|
142
311
|
[type]: {
|
|
@@ -144,17 +313,18 @@ function convertType(type) {
|
|
|
144
313
|
scale: undefined
|
|
145
314
|
}
|
|
146
315
|
};
|
|
147
|
-
case "string":
|
|
316
|
+
case type === "string":
|
|
148
317
|
return {
|
|
149
318
|
type,
|
|
150
319
|
[type]: {
|
|
151
320
|
analyzerOverride: undefined,
|
|
152
321
|
enableAsciiFolding: undefined,
|
|
153
322
|
isLongText: false,
|
|
323
|
+
supportsEfficientLeadingWildcard: false,
|
|
154
324
|
supportsExactMatching: true
|
|
155
325
|
}
|
|
156
326
|
};
|
|
157
|
-
case "mediaReference":
|
|
327
|
+
case type === "mediaReference":
|
|
158
328
|
return {
|
|
159
329
|
type: type,
|
|
160
330
|
mediaReference: {}
|
|
@@ -164,6 +334,7 @@ function convertType(type) {
|
|
|
164
334
|
return distributeTypeHelper(type);
|
|
165
335
|
}
|
|
166
336
|
}
|
|
337
|
+
|
|
167
338
|
/**
|
|
168
339
|
* Helper function to avoid duplication. Makes the types match properly with the correct
|
|
169
340
|
* behavior without needing to switch on 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","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,kB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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,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":[]}
|
|
1
|
+
{"version":3,"file":"defineOntology.js","names":["ontologyDefinition","namespace","defineOntology","ns","body","actionTypes","objectTypes","queryTypes","interfaceTypes","sharedPropertyTypes","valueTypes","importedTypes","e","console","error","ontology","convertToWireOntologyIr","valueType","convertOntologyToValueTypeIr","Object","values","map","definitions","metadata","apiName","displayMetadata","status","versions","definition","version","baseType","constraints","exampleValues","blockData","fromEntries","entries","objectType","convertObject","spt","sharedPropertyType","convertSpt","interfaceType","convertInterface","blockPermissionInformation","linkTypes","propertyDatasource","properties","forEach","property","type","column","datasource","rid","concat","datasetV2","datasetRid","propertyMapping","editsConfiguration","onlyAllowPrivilegedEdits","redacted","implementations","implementsInterfaces","description","displayName","groupDisplayName","undefined","icon","blueprint","locator","color","pluralDisplayName","visibility","primaryKeys","propertyTypes","val","convertProperty","titlePropertyTypeRid","titlePropertyApiName","active","implementsInterfaces2","impl","interfaceTypeApiName","implements","mapping","interfaceProperty","propertyTypeRid","mapsTo","allImplementsInterfaces","datasources","entityMetadata","arePatchesEnabled","editsEnabled","output","sharedPropertyTypeApiName","indexedForSearch","ruleSetBinding","baseFormatter","convertType","typeClasses","inlineAction","dataConstraints","sharedPropertyTypeRid","allExtendsInterfaces","allLinks","allProperties","dumpOntologyFullMetadata","dumpValueTypeWireType","array","gothamMapping","dataConstraint","propertyTypeConstraints","nullability","nullabilityV2","noEmptyCollections","noNulls","subtype","aliases","provenance","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","field","fieldType","push","struct","geohash","precision","scale","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","mediaReference","distributeTypeHelper"],"sources":["defineOntology.ts"],"sourcesContent":["/*\n * Copyright 2025 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/*\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\nimport type {\n OntologyIr,\n OntologyIrInterfaceType,\n OntologyIrInterfaceTypeBlockDataV2,\n OntologyIrObjectTypeBlockDataV2,\n OntologyIrObjectTypeDatasource,\n OntologyIrPropertyType,\n OntologyIrSharedPropertyType,\n OntologyIrSharedPropertyTypeBlockDataV2,\n OntologyIrStructFieldType,\n OntologyIrType,\n OntologyIrValueTypeBlockData,\n OntologyIrValueTypeBlockDataEntry,\n PropertyTypeMappingInfo,\n} from \"@osdk/client.unstable\";\nimport type {\n InterfaceType,\n ObjectPropertyType,\n ObjectType,\n Ontology,\n PropertyTypeType,\n SharedPropertyType,\n} from \"./types.js\";\n\n/** @internal */\nexport let ontologyDefinition: Ontology;\n\n/** @internal */\nexport let namespace: string;\n\ntype OntologyAndValueTypeIrs = {\n ontology: OntologyIr;\n valueType: OntologyIrValueTypeBlockData;\n};\n\nexport async function defineOntology(\n ns: string,\n body: () => void | Promise<void>,\n): Promise<OntologyAndValueTypeIrs> {\n namespace = ns;\n ontologyDefinition = {\n actionTypes: {},\n objectTypes: {},\n queryTypes: {},\n interfaceTypes: {},\n sharedPropertyTypes: {},\n valueTypes: {},\n importedTypes: {\n sharedPropertyTypes: [],\n },\n };\n\n try {\n await body();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected error while processing the body of the ontology\",\n e,\n );\n throw e;\n }\n\n return {\n ontology: convertToWireOntologyIr(ontologyDefinition),\n valueType: convertOntologyToValueTypeIr(ontologyDefinition),\n };\n}\n\nfunction convertOntologyToValueTypeIr(\n ontology: Ontology,\n): OntologyIrValueTypeBlockData {\n return {\n valueTypes: Object.values(ontology.valueTypes).map<\n OntologyIrValueTypeBlockDataEntry\n >(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}\n\nfunction convertToWireOntologyIr(\n ontology: Ontology,\n): OntologyIr {\n return {\n blockData: {\n objectTypes: Object.fromEntries(\n Object.entries(ontology.objectTypes).map<\n [string, OntologyIrObjectTypeBlockDataV2]\n >(([apiName, objectType]) => {\n return [apiName, convertObject(objectType)];\n }),\n ),\n sharedPropertyTypes: Object.fromEntries(\n Object.entries(\n ontology.sharedPropertyTypes,\n )\n .map<[string, OntologyIrSharedPropertyTypeBlockDataV2]>((\n [apiName, spt],\n ) => [apiName, { sharedPropertyType: convertSpt(spt) }]),\n ),\n interfaceTypes: Object.fromEntries(\n Object.entries(\n ontology.interfaceTypes,\n )\n .map<[string, OntologyIrInterfaceTypeBlockDataV2]>(\n ([apiName, interfaceType]) => {\n return [apiName, {\n interfaceType: convertInterface(interfaceType),\n }];\n },\n ),\n ),\n blockPermissionInformation: {\n actionTypes: {},\n linkTypes: {},\n objectTypes: {},\n },\n },\n importedTypes: ontology.importedTypes,\n };\n}\n\nfunction convertObject(\n objectType: ObjectType,\n): OntologyIrObjectTypeBlockDataV2 {\n const propertyDatasource: Record<string, PropertyTypeMappingInfo> = {};\n (objectType.properties ?? []).forEach((property) => {\n propertyDatasource[property.apiName] = {\n type: \"column\",\n column: property.apiName,\n };\n });\n\n const datasource: OntologyIrObjectTypeDatasource = {\n rid: \"ri.ontology.main.datasource.\".concat(objectType.apiName),\n datasource: {\n type: \"datasetV2\",\n datasetV2: {\n datasetRid: objectType.apiName,\n propertyMapping: propertyDatasource,\n },\n },\n editsConfiguration: {\n onlyAllowPrivilegedEdits: false,\n },\n redacted: false,\n };\n\n const implementations = objectType.implementsInterfaces ?? [];\n\n return {\n objectType: {\n displayMetadata: {\n description: objectType.description,\n displayName: objectType.displayName,\n groupDisplayName: undefined,\n icon: {\n type: \"blueprint\",\n blueprint: objectType.icon ?? { locator: \"cube\", color: \"#2D72D2\" },\n },\n pluralDisplayName: objectType.pluralDisplayName,\n visibility: objectType.visibility ?? \"NORMAL\",\n },\n primaryKeys: objectType.primaryKeys,\n propertyTypes: Object.fromEntries(\n objectType.properties?.map<[string, OntologyIrPropertyType]>(\n val => [val.apiName, convertProperty(val)],\n ) ?? [],\n ),\n titlePropertyTypeRid: objectType.titlePropertyApiName,\n apiName: objectType.apiName,\n status: objectType.status ?? {\n type: \"active\",\n active: {},\n },\n redacted: false,\n implementsInterfaces2: implementations.map(impl => ({\n interfaceTypeApiName: impl.implements.apiName,\n properties: Object.fromEntries(\n impl.propertyMapping.map(\n mapping => [namespace + mapping.interfaceProperty, {\n propertyTypeRid: mapping.mapsTo,\n }],\n ),\n ),\n })),\n allImplementsInterfaces: {},\n },\n datasources: [datasource],\n entityMetadata: { arePatchesEnabled: objectType.editsEnabled ?? false },\n };\n}\n\nfunction convertProperty(property: ObjectPropertyType): OntologyIrPropertyType {\n const output: OntologyIrPropertyType = {\n apiName: property.apiName,\n sharedPropertyTypeApiName: property.sharedPropertyType?.apiName,\n displayMetadata: {\n displayName: property.displayName,\n description: property.description,\n visibility: property.visibility ?? \"NORMAL\",\n },\n indexedForSearch: property.indexedForSearch ?? true,\n ruleSetBinding: undefined,\n baseFormatter: property.baseFormatter,\n type: convertType(property.type),\n typeClasses: property.typeClasses ?? [],\n status: property.status ?? { type: \"active\", active: {} },\n inlineAction: undefined,\n dataConstraints: property.dataConstraints,\n sharedPropertyTypeRid: property.sharedPropertyType?.apiName,\n valueType: undefined,\n };\n return output;\n}\n\nfunction convertInterface(\n interfaceType: InterfaceType,\n): OntologyIrInterfaceType {\n return {\n ...interfaceType,\n properties: Object.values(interfaceType.properties)\n .map<OntologyIrSharedPropertyType>((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}\n\nexport function dumpOntologyFullMetadata(): OntologyIr {\n return convertToWireOntologyIr(ontologyDefinition);\n}\n\nexport function dumpValueTypeWireType(): OntologyIrValueTypeBlockData {\n return convertOntologyToValueTypeIr(ontologyDefinition);\n}\n\nfunction convertSpt(\n {\n type,\n array,\n description,\n apiName,\n displayName,\n gothamMapping,\n typeClasses,\n valueType,\n }: SharedPropertyType,\n): OntologyIrSharedPropertyType {\n const dataConstraint:\n | OntologyIrSharedPropertyType[\"dataConstraints\"]\n | undefined = (typeof type === \"object\" && type.type === \"marking\")\n ? {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: { noEmptyCollections: true, noNulls: true },\n }\n : undefined;\n return {\n apiName,\n displayMetadata: {\n displayName: displayName ?? apiName,\n visibility: \"NORMAL\",\n description,\n },\n type: array\n ? {\n type: \"array\" as const,\n array: {\n subtype: convertType(type),\n },\n }\n : convertType(type),\n aliases: [],\n baseFormatter: undefined,\n dataConstraints: dataConstraint,\n gothamMapping: gothamMapping,\n indexedForSearch: true,\n provenance: undefined,\n typeClasses: typeClasses ?? [],\n valueType: valueType,\n };\n}\n\nfunction convertType(\n type: PropertyTypeType,\n): OntologyIrType {\n switch (true) {\n case (typeof type === \"object\" && \"markingType\" in type):\n return {\n \"type\": \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case (typeof type === \"object\" && \"structDefinition\" in type):\n const structFields: Array<OntologyIrStructFieldType> = new Array();\n for (const key in type.structDefinition) {\n const fieldTypeDefinition = type.structDefinition[key];\n let field: OntologyIrStructFieldType;\n if (typeof fieldTypeDefinition === \"string\") {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: convertType(fieldTypeDefinition),\n };\n } else {\n // If it is a full form type definition then process it as such\n if (\"fieldType\" in fieldTypeDefinition) {\n field = {\n ...fieldTypeDefinition,\n apiName: key,\n fieldType: convertType(fieldTypeDefinition.fieldType),\n typeClasses: fieldTypeDefinition.typeClasses ?? [],\n aliases: fieldTypeDefinition.aliases ?? [],\n };\n } else {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: convertType(fieldTypeDefinition),\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: { structFields },\n };\n\n case (type === \"geopoint\"):\n return { type: \"geohash\", geohash: {} };\n\n case (type === \"decimal\"):\n return { type, [type]: { precision: undefined, scale: undefined } };\n\n case (type === \"string\"):\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsEfficientLeadingWildcard: false,\n supportsExactMatching: true,\n },\n };\n\n case (type === \"mediaReference\"):\n return {\n type: type,\n mediaReference: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n return distributeTypeHelper(type);\n }\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<T extends string>(\n type: T,\n): T extends any ? { type: T } & { [K in T]: {} } : never {\n return { type, [type]: {} } as any; // 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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA;AACA,OAAO,IAAIA,kBAA4B;;AAEvC;AACA,OAAO,IAAIC,SAAiB;AAO5B,OAAO,eAAeC,cAAcA,CAClCC,EAAU,EACVC,IAAgC,EACE;EAClCH,SAAS,GAAGE,EAAE;EACdH,kBAAkB,GAAG;IACnBK,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,CAAC;IACdC,aAAa,EAAE;MACbF,mBAAmB,EAAE;IACvB;E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AACA,IAAI,GAAG,CAAC;EAAE,CAAC,CAAQ,CAAC;AACtC","ignoreList":[]}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
|
|
16
17
|
import invariant from "tiny-invariant";
|
|
17
18
|
import { namespace, ontologyDefinition } from "./defineOntology.js";
|
|
18
19
|
const defaultTypeClasses = [{
|
|
@@ -24,10 +25,11 @@ const defaultTypeClasses = [{
|
|
|
24
25
|
}];
|
|
25
26
|
export function defineSharedPropertyType(opts) {
|
|
26
27
|
const apiName = namespace + opts.apiName;
|
|
27
|
-
!(ontologyDefinition.sharedPropertyTypes[apiName] === undefined) ? invariant(false, `Shared property type ${apiName} already exists`) : void 0;
|
|
28
|
+
!(ontologyDefinition.sharedPropertyTypes[apiName] === undefined) ? process.env.NODE_ENV !== "production" ? invariant(false, `Shared property type ${apiName} already exists`) : invariant(false) : void 0;
|
|
28
29
|
return ontologyDefinition.sharedPropertyTypes[apiName] = {
|
|
29
30
|
...opts,
|
|
30
31
|
apiName,
|
|
32
|
+
nonNameSpacedApiName: opts.apiName,
|
|
31
33
|
displayName: opts.displayName ?? opts.apiName,
|
|
32
34
|
// This way the non-namespaced api name is the display name (maybe not ideal)
|
|
33
35
|
typeClasses: opts.typeClasses ?? defaultTypeClasses
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSpt.js","names":["invariant","namespace","ontologyDefinition","defaultTypeClasses","kind","name","defineSharedPropertyType","opts","apiName","sharedPropertyTypes","undefined","displayName","typeClasses"],"sources":["defineSpt.
|
|
1
|
+
{"version":3,"file":"defineSpt.js","names":["invariant","namespace","ontologyDefinition","defaultTypeClasses","kind","name","defineSharedPropertyType","opts","apiName","sharedPropertyTypes","undefined","process","env","NODE_ENV","nonNameSpacedApiName","displayName","typeClasses"],"sources":["defineSpt.ts"],"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\nimport type {\n ApiNameValueTypeReference,\n SharedPropertyTypeGothamMapping,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { namespace, ontologyDefinition } from \"./defineOntology.js\";\nimport type { PropertyTypeType, SharedPropertyType } from \"./types.js\";\n\nconst defaultTypeClasses: SharedPropertyType[\"typeClasses\"] = [{\n kind: \"render_hint\",\n name: \"SELECTABLE\",\n}, { kind: \"render_hint\", name: \"SORTABLE\" }];\n\nexport function defineSharedPropertyType(\n opts: {\n apiName: string;\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: ApiNameValueTypeReference;\n typeClasses?: SharedPropertyType[\"typeClasses\"];\n gothamMapping?: SharedPropertyTypeGothamMapping;\n },\n): SharedPropertyType {\n const apiName = namespace + opts.apiName;\n invariant(\n ontologyDefinition.sharedPropertyTypes[apiName] === undefined,\n `Shared property type ${apiName} already exists`,\n );\n\n return ontologyDefinition.sharedPropertyTypes[apiName] = {\n ...opts,\n apiName,\n nonNameSpacedApiName: opts.apiName,\n displayName: opts.displayName ?? opts.apiName, // This way the non-namespaced api name is the display name (maybe not ideal)\n typeClasses: opts.typeClasses ?? defaultTypeClasses,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,EAAEC,kBAAkB,QAAQ,qBAAqB;AAGnE,MAAMC,kBAAqD,GAAG,CAAC;EAC7DC,IAAI,EAAE,aAAa;EACnBC,IAAI,EAAE;AACR,CAAC,EAAE;EAAED,IAAI,EAAE,aAAa;EAAEC,IAAI,EAAE;AAAW,CAAC,CAAC;AAE7C,OAAO,SAASC,wBAAwBA,CACtCC,IASC,EACmB;EACpB,MAAMC,OAAO,GAAGP,SAAS,GAAGM,IAAI,CAACC,OAAO;EACxC,EACEN,kBAAkB,CAACO,mBAAmB,CAACD,OAAO,CAAC,KAAKE,SAAS,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAD/Db,SAAS,QAEP,wBAAwBQ,OAAO,iBAAiB,IAFlDR,SAAS;EAKT,OAAOE,kBAAkB,CAACO,mBAAmB,CAACD,OAAO,CAAC,GAAG;IACvD,GAAGD,IAAI;IACPC,OAAO;IACPM,oBAAoB,EAAEP,IAAI,CAACC,OAAO;IAClCO,WAAW,EAAER,IAAI,CAACQ,WAAW,IAAIR,IAAI,CAACC,OAAO;IAAE;IAC/CQ,WAAW,EAAET,IAAI,CAACS,WAAW,IAAIb;EACnC,CAAC;AACH","ignoreList":[]}
|
|
@@ -13,30 +13,77 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
|
|
16
17
|
import invariant from "tiny-invariant";
|
|
17
18
|
import { ontologyDefinition } from "./defineOntology.js";
|
|
19
|
+
function convertValueTypeTypeToBaseType(valueType) {
|
|
20
|
+
if (typeof valueType === "string") {}
|
|
21
|
+
switch (true) {
|
|
22
|
+
case typeof valueType === "object" && valueType.type === "array":
|
|
23
|
+
return {
|
|
24
|
+
type: "array",
|
|
25
|
+
array: {
|
|
26
|
+
elementType: convertValueTypeTypeToBaseType(valueType.elementType)
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
case typeof valueType === "object" && valueType.type === "struct":
|
|
30
|
+
return {
|
|
31
|
+
type: "structV2",
|
|
32
|
+
structV2: {
|
|
33
|
+
fields: valueType.fields.map(field => ({
|
|
34
|
+
identifier: field.identifier,
|
|
35
|
+
baseType: convertValueTypeTypeToBaseType(field.baseType)
|
|
36
|
+
}))
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
case typeof valueType === "object" && valueType.type === "map":
|
|
40
|
+
return {
|
|
41
|
+
type: "map",
|
|
42
|
+
map: {
|
|
43
|
+
keyType: convertValueTypeTypeToBaseType(valueType.keyType),
|
|
44
|
+
valueType: convertValueTypeTypeToBaseType(valueType.valueType)
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
case typeof valueType === "object" && valueType.type === "optional":
|
|
48
|
+
return {
|
|
49
|
+
type: "optional",
|
|
50
|
+
optional: {
|
|
51
|
+
wrappedType: convertValueTypeTypeToBaseType(valueType.wrappedType)
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
case typeof valueType === "string":
|
|
55
|
+
return {
|
|
56
|
+
type: valueType,
|
|
57
|
+
[valueType]: {}
|
|
58
|
+
};
|
|
59
|
+
default:
|
|
60
|
+
throw new Error("Invalid ValueTypeType");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
18
63
|
export function defineValueType(opts) {
|
|
19
64
|
const {
|
|
20
65
|
apiName,
|
|
21
66
|
displayName,
|
|
22
67
|
description,
|
|
23
|
-
|
|
68
|
+
type,
|
|
24
69
|
version
|
|
25
70
|
} = opts;
|
|
26
|
-
!/^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$/.test(version) ? invariant(false, "Version is not a valid semver") : void 0;
|
|
71
|
+
!/^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$/.test(version) ? process.env.NODE_ENV !== "production" ? invariant(false, "Version is not a valid semver") : invariant(false) : void 0;
|
|
72
|
+
const typeName = typeof type.type === "string" ? type.type : type.type.type === "struct" ? "structV2" : type.type.type;
|
|
27
73
|
// These suck but TS doesn't understand the relationship from the key of the base type to the type string
|
|
28
|
-
const constraints =
|
|
29
|
-
|
|
74
|
+
const constraints = type.constraints ? type.constraints.map(constraint => {
|
|
75
|
+
const output = {
|
|
30
76
|
constraint: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
77
|
+
type: typeName,
|
|
78
|
+
[typeName]: constraint.constraint
|
|
79
|
+
},
|
|
80
|
+
failureMessage: constraint.failureMessage
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
constraint: output
|
|
34
84
|
};
|
|
35
85
|
}) : [];
|
|
36
|
-
const baseType =
|
|
37
|
-
[Object.keys(typeAndConstraints.baseType)[0]]: Object.keys(typeAndConstraints.baseType)[0],
|
|
38
|
-
...typeAndConstraints.baseType
|
|
39
|
-
};
|
|
86
|
+
const baseType = convertValueTypeTypeToBaseType(type.type);
|
|
40
87
|
const vt = {
|
|
41
88
|
apiName,
|
|
42
89
|
displayMetadata: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineValueType.js","names":["invariant","ontologyDefinition","defineValueType","opts","apiName","displayName","description","
|
|
1
|
+
{"version":3,"file":"defineValueType.js","names":["invariant","ontologyDefinition","convertValueTypeTypeToBaseType","valueType","type","array","elementType","structV2","fields","map","field","identifier","baseType","keyType","optional","wrappedType","Error","defineValueType","opts","apiName","displayName","description","version","test","process","env","NODE_ENV","typeName","constraints","constraint","output","failureMessage","vt","displayMetadata","status","active","exampleValues","valueTypes","undefined","push"],"sources":["defineValueType.ts"],"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\nimport type {\n BaseType,\n DataConstraint,\n DataConstraintWrapper,\n FailureMessage,\n ValueTypeDataConstraint,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { ontologyDefinition } from \"./defineOntology.js\";\nimport type { ValueTypeDefinitionVersion, ValueTypeType } from \"./types.js\";\n\ntype ZipBaseAndConstraint<Base, Constraint> = {\n [PropertyType in (BaseType[\"type\"] & DataConstraint[\"type\"])]: Base extends\n { type: PropertyType } ? {\n baseType: Omit<Base, \"type\">;\n constraints?: Constraint extends { type: PropertyType } ? {\n constraint: Omit<Constraint, \"type\">;\n failureMessage?: FailureMessage;\n }[]\n : undefined;\n }\n : never;\n};\n\ntype MappedZip = ZipBaseAndConstraint<BaseType, DataConstraint>;\n\ntype TypeNames = ValueTypeType[\"type\"];\n\ntype ValueTypeDefinitionBacking = {\n [Type in ValueTypeType[\"type\"] & DataConstraint[\"type\"]]: {\n baseType: { \"type\": Extract<ValueTypeType, { type: Type }>[\"value\"] } & {\n constraints: {\n constraint: Extract<\n DataConstraint,\n { type: Type }\n >[keyof Omit<Extract<DataConstraint, { type: Type }>, \"type\">];\n failureMessage?: FailureMessage;\n }[];\n };\n };\n};\n\ntype NewValueTypeDefinitionBacking = {\n [Type in ValueTypeType as Type[\"type\"]]: {\n type: Type[\"value\"];\n constraints?: Type[\"constraints\"];\n };\n};\ntype NewValueTypeDefinition =\n NewValueTypeDefinitionBacking[keyof NewValueTypeDefinitionBacking];\n\nfunction convertValueTypeTypeToBaseType(\n valueType: ValueTypeType[\"value\"],\n): BaseType {\n if (typeof valueType === \"string\") {\n }\n switch (true) {\n case (typeof valueType === \"object\" && valueType.type === \"array\"):\n return {\n type: \"array\",\n array: {\n elementType: convertValueTypeTypeToBaseType(valueType.elementType),\n },\n };\n case (typeof valueType === \"object\" && valueType.type === \"struct\"):\n return {\n type: \"structV2\",\n structV2: {\n fields: valueType.fields.map(field => ({\n identifier: field.identifier,\n baseType: convertValueTypeTypeToBaseType(field.baseType),\n })),\n },\n };\n case (typeof valueType === \"object\" && valueType.type === \"map\"):\n return {\n type: \"map\",\n map: {\n keyType: convertValueTypeTypeToBaseType(valueType.keyType),\n valueType: convertValueTypeTypeToBaseType(valueType.valueType),\n },\n };\n case (typeof valueType === \"object\" && valueType.type === \"optional\"):\n return {\n type: \"optional\",\n optional: {\n wrappedType: convertValueTypeTypeToBaseType(valueType.wrappedType),\n },\n };\n case (typeof valueType === \"string\"):\n return { type: valueType, [valueType]: {} } as any;\n default:\n throw new Error(\"Invalid ValueTypeType\");\n }\n}\n\nexport function defineValueType(\n opts: {\n apiName: string;\n displayName: string;\n description?: string;\n type: NewValueTypeDefinition;\n version: string;\n },\n): ValueTypeDefinitionVersion {\n const { apiName, displayName, description, type, version } = opts;\n const semverValidation =\n /^((([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)$/;\n invariant(semverValidation.test(version), \"Version is not a valid semver\");\n\n const typeName: TypeNames = typeof type.type === \"string\"\n ? type.type\n : type.type.type === \"struct\"\n ? \"structV2\"\n : type.type.type;\n // These suck but TS doesn't understand the relationship from the key of the base type to the type string\n const constraints = type.constraints\n ? type.constraints.map<ValueTypeDataConstraint>(constraint => {\n const output: any = {\n constraint: { type: typeName, [typeName]: constraint.constraint },\n failureMessage: constraint.failureMessage,\n };\n return { constraint: output as DataConstraintWrapper };\n })\n : [];\n\n const baseType: BaseType = convertValueTypeTypeToBaseType(type.type);\n\n const vt: ValueTypeDefinitionVersion = {\n apiName,\n displayMetadata: {\n displayName: displayName,\n description: description ?? \"\",\n },\n status: { type: \"active\", active: {} },\n version: version,\n baseType: baseType,\n constraints: constraints,\n exampleValues: [],\n };\n if (ontologyDefinition.valueTypes[apiName] === undefined) {\n ontologyDefinition.valueTypes[apiName] = [];\n }\n ontologyDefinition.valueTypes[apiName].push(vt);\n return vt;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,kBAAkB,QAAQ,qBAAqB;AA2CxD,SAASC,8BAA8BA,CACrCC,SAAiC,EACvB;EACV,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE,CACnC;EACA,QAAQ,IAAI;IACV,KAAM,OAAOA,SAAS,KAAK,QAAQ,IAAIA,SAAS,CAACC,IAAI,KAAK,OAAO;MAC/D,OAAO;QACLA,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE;UACLC,WAAW,EAAEJ,8BAA8B,CAACC,SAAS,CAACG,WAAW;QACnE;MACF,CAAC;IACH,KAAM,OAAOH,SAAS,KAAK,QAAQ,IAAIA,SAAS,CAACC,IAAI,KAAK,QAAQ;MAChE,OAAO;QACLA,IAAI,EAAE,UAAU;QAChBG,QAAQ,EAAE;UACRC,MAAM,EAAEL,SAAS,CAACK,MAAM,CAACC,GAAG,CAACC,KAAK,KAAK;YACrCC,UAAU,EAAED,KAAK,CAACC,UAAU;YAC5BC,QAAQ,EAAEV,8BAA8B,CAACQ,KAAK,CAACE,QAAQ;UACzD,CAAC,CAAC;QACJ;MACF,CAAC;IACH,KAAM,OAAOT,SAAS,KAAK,QAAQ,IAAIA,SAAS,CAACC,IAAI,KAAK,KAAK;MAC7D,OAAO;QACLA,IAAI,EAAE,KAAK;QACXK,GAAG,EAAE;UACHI,OAAO,EAAEX,8BAA8B,CAACC,SAAS,CAACU,OAAO,CAAC;UAC1DV,SAAS,EAAED,8BAA8B,CAACC,SAAS,CAACA,SAAS;QAC/D;MACF,CAAC;IACH,KAAM,OAAOA,SAAS,KAAK,QAAQ,IAAIA,SAAS,CAACC,IAAI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pE,MAAM4B,EAA8B,GAAG;IACrCb,OAAO;IACPc,eAAe,EAAE;MACfb,WAAW,EAAEA,WAAW;MACxBC,WAAW,EAAEA,WAAW,IAAI;IAC9B,CAAC;IACDa,MAAM,EAAE;MAAE9B,IAAI,EAAE,QAAQ;MAAE+B,MAAM,EAAE,CAAC;IAAE,CAAC;IACtCb,OAAO,EAAEA,OAAO;IAChBV,QAAQ,EAAEA,QAAQ;IAClBgB,WAAW,EAAEA,WAAW;IACxBQ,aAAa,EAAE;EACjB,CAAC;EACD,IAAInC,kBAAkB,CAACoC,UAAU,CAAClB,OAAO,CAAC,KAAKmB,SAAS,EAAE;IACxDrC,kBAAkB,CAACoC,UAAU,CAAClB,OAAO,CAAC,GAAG,EAAE;EAC7C;EACAlB,kBAAkB,CAACoC,UAAU,CAAClB,OAAO,CAAC,CAACoB,IAAI,CAACP,EAAE,CAAC;EAC/C,OAAOA,EAAE;AACX","ignoreList":[]}
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
1
|
export {};
|
|
17
2
|
//# sourceMappingURL=iconNames.js.map
|