@osdk/maker 0.15.0-beta.9 → 0.16.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -0
- package/build/browser/api/defineAction.js +4 -0
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/object/ObjectTypeDatasourceDefinition.js.map +1 -1
- package/build/browser/api/object/SecurityCondition.js +2 -0
- package/build/browser/api/object/SecurityCondition.js.map +1 -0
- package/build/browser/api/properties/PropertyTypeType.js.map +1 -1
- package/build/browser/api/propertyConversionUtils.js +5 -1
- package/build/browser/api/propertyConversionUtils.js.map +1 -1
- package/build/browser/api/test/actions.test.js +52 -0
- package/build/browser/api/test/actions.test.js.map +1 -1
- package/build/browser/api/test/links.test.js +36 -0
- package/build/browser/api/test/links.test.js.map +1 -1
- package/build/browser/api/test/misc.test.js +4 -0
- package/build/browser/api/test/misc.test.js.map +1 -1
- package/build/browser/api/test/objects.test.js +804 -0
- package/build/browser/api/test/objects.test.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js +179 -0
- package/build/browser/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertNullabilityToDataConstraint.js +0 -1
- package/build/browser/conversion/toMarketplace/convertNullabilityToDataConstraint.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertObject.js +4 -0
- package/build/browser/conversion/toMarketplace/convertObject.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js +2 -2
- package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -1
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +5 -0
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/cjs/index.cjs +265 -73
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +33 -2
- package/build/esm/api/defineAction.js +4 -0
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/object/ObjectTypeDatasourceDefinition.js.map +1 -1
- package/build/esm/api/object/SecurityCondition.js +2 -0
- package/build/esm/api/object/SecurityCondition.js.map +1 -0
- package/build/esm/api/properties/PropertyTypeType.js.map +1 -1
- package/build/esm/api/propertyConversionUtils.js +5 -1
- package/build/esm/api/propertyConversionUtils.js.map +1 -1
- package/build/esm/api/test/actions.test.js +52 -0
- package/build/esm/api/test/actions.test.js.map +1 -1
- package/build/esm/api/test/links.test.js +36 -0
- package/build/esm/api/test/links.test.js.map +1 -1
- package/build/esm/api/test/misc.test.js +4 -0
- package/build/esm/api/test/misc.test.js.map +1 -1
- package/build/esm/api/test/objects.test.js +804 -0
- package/build/esm/api/test/objects.test.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js +179 -0
- package/build/esm/conversion/toMarketplace/convertDatasourceDefinition.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertNullabilityToDataConstraint.js +0 -1
- package/build/esm/conversion/toMarketplace/convertNullabilityToDataConstraint.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertObject.js +4 -0
- package/build/esm/conversion/toMarketplace/convertObject.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js +2 -2
- package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -1
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +5 -0
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/types/api/defineAction.d.ts.map +1 -1
- package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts +15 -1
- package/build/types/api/object/ObjectTypeDatasourceDefinition.d.ts.map +1 -1
- package/build/types/api/object/SecurityCondition.d.ts +18 -0
- package/build/types/api/object/SecurityCondition.d.ts.map +1 -0
- package/build/types/api/properties/PropertyTypeType.d.ts +1 -1
- package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -1
- package/build/types/api/propertyConversionUtils.d.ts +1 -0
- package/build/types/api/propertyConversionUtils.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertDatasourceDefinition.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertObject.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertObjectPropertyType.d.ts.map +1 -1
- package/package.json +5 -5
package/build/esm/cli/main.js
CHANGED
|
@@ -24,7 +24,7 @@ import { defineOntology } from "../api/defineOntology.js";
|
|
|
24
24
|
const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
25
25
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
26
26
|
export default async function main(args = process.argv) {
|
|
27
|
-
const commandLineOpts = await yargs(hideBin(args)).version("0.
|
|
27
|
+
const commandLineOpts = await yargs(hideBin(args)).version("0.16.0-beta.1" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
|
|
28
28
|
input: {
|
|
29
29
|
alias: "i",
|
|
30
30
|
describe: "Input file",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import invariant from "tiny-invariant";
|
|
17
18
|
export function convertDatasourceDefinition(objectType, properties) {
|
|
18
19
|
const baseDatasource = objectType.datasources?.find(ds => ["dataset", "stream", "restrictedView"].includes(ds.type));
|
|
19
20
|
switch (baseDatasource?.type) {
|
|
@@ -46,8 +47,27 @@ export function convertDatasourceDefinition(objectType, properties) {
|
|
|
46
47
|
propertyMapping: buildPropertyMapping(properties)
|
|
47
48
|
}
|
|
48
49
|
};
|
|
50
|
+
case "derived":
|
|
51
|
+
return {
|
|
52
|
+
type: "datasetV2",
|
|
53
|
+
datasetV2: {
|
|
54
|
+
datasetRid: objectType.apiName,
|
|
55
|
+
propertyMapping: buildPropertyMapping(properties)
|
|
56
|
+
}
|
|
57
|
+
};
|
|
49
58
|
case "dataset":
|
|
50
59
|
default:
|
|
60
|
+
if (objectType.properties?.some(prop => typeof prop.type === "object" && prop.type.type === "marking") || baseDatasource?.objectSecurityPolicy || baseDatasource?.propertySecurityGroups) {
|
|
61
|
+
return {
|
|
62
|
+
type: "datasetV3",
|
|
63
|
+
datasetV3: {
|
|
64
|
+
datasetRid: objectType.apiName,
|
|
65
|
+
propertyMapping: buildPropertyMapping(properties),
|
|
66
|
+
branchId: "master",
|
|
67
|
+
propertySecurityGroups: convertPropertySecurityGroups(baseDatasource, properties, objectType.primaryKeyPropertyApiName)
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
51
71
|
return {
|
|
52
72
|
type: "datasetV2",
|
|
53
73
|
datasetV2: {
|
|
@@ -57,6 +77,165 @@ export function convertDatasourceDefinition(objectType, properties) {
|
|
|
57
77
|
};
|
|
58
78
|
}
|
|
59
79
|
}
|
|
80
|
+
function convertPropertySecurityGroups(ds, properties, primaryKeyPropertyApiName) {
|
|
81
|
+
if (!ds || !("objectSecurityPolicy" in ds) && !("propertySecurityGroups" in ds)) {
|
|
82
|
+
return {
|
|
83
|
+
groups: [{
|
|
84
|
+
properties: properties.map(prop => prop.apiName),
|
|
85
|
+
rid: "defaultObjectSecurityPolicy",
|
|
86
|
+
security: {
|
|
87
|
+
type: "granular",
|
|
88
|
+
granular: {
|
|
89
|
+
viewPolicy: {
|
|
90
|
+
granularPolicyCondition: {
|
|
91
|
+
type: "and",
|
|
92
|
+
and: {
|
|
93
|
+
conditions: []
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
additionalMandatory: {
|
|
97
|
+
markings: {},
|
|
98
|
+
assumedMarkings: []
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
type: {
|
|
104
|
+
type: "primaryKey",
|
|
105
|
+
primaryKey: {}
|
|
106
|
+
}
|
|
107
|
+
}]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const validPropertyNames = new Set(properties.map(prop => prop.apiName));
|
|
111
|
+
const usedProperties = new Set();
|
|
112
|
+
ds.propertySecurityGroups?.forEach(psg => {
|
|
113
|
+
psg.properties.forEach(propertyName => {
|
|
114
|
+
!validPropertyNames.has(propertyName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Property "${propertyName}" in property security group ${psg.name} does not exist in the properties list`) : invariant(false) : void 0;
|
|
115
|
+
!!usedProperties.has(propertyName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Property "${propertyName}" is used in multiple property security groups`) : invariant(false) : void 0;
|
|
116
|
+
!(propertyName !== primaryKeyPropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Property "${propertyName}" in property security group ${psg.name} cannot be the primary key`) : invariant(false) : void 0;
|
|
117
|
+
usedProperties.add(propertyName);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
const objectSecurityPolicyGroup = {
|
|
121
|
+
rid: ds.objectSecurityPolicy?.name || "defaultObjectSecurityPolicy",
|
|
122
|
+
security: {
|
|
123
|
+
type: "granular",
|
|
124
|
+
granular: convertGranularPolicy(ds.objectSecurityPolicy?.granularPolicy, ds.objectSecurityPolicy?.additionalMandatoryMarkings)
|
|
125
|
+
},
|
|
126
|
+
type: {
|
|
127
|
+
type: "primaryKey",
|
|
128
|
+
primaryKey: {}
|
|
129
|
+
},
|
|
130
|
+
properties: properties.filter(prop => !usedProperties.has(prop.apiName)).map(prop => prop.apiName)
|
|
131
|
+
};
|
|
132
|
+
return {
|
|
133
|
+
groups: [objectSecurityPolicyGroup, ...(ds.propertySecurityGroups?.map(psg => ({
|
|
134
|
+
rid: psg.name,
|
|
135
|
+
security: {
|
|
136
|
+
type: "granular",
|
|
137
|
+
granular: convertGranularPolicy(psg.granularPolicy, psg.additionalMandatoryMarkings)
|
|
138
|
+
},
|
|
139
|
+
type: {
|
|
140
|
+
type: "property",
|
|
141
|
+
property: {
|
|
142
|
+
name: psg.name
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
properties: psg.properties ?? []
|
|
146
|
+
})) ?? [])]
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function convertGranularPolicy(granularPolicy, additionalMandatoryMarkings) {
|
|
150
|
+
return {
|
|
151
|
+
viewPolicy: {
|
|
152
|
+
granularPolicyCondition: granularPolicy ? convertSecurityCondition(granularPolicy) : {
|
|
153
|
+
type: "and",
|
|
154
|
+
and: {
|
|
155
|
+
conditions: []
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
additionalMandatory: {
|
|
159
|
+
markings: additionalMandatoryMarkings ?? {},
|
|
160
|
+
assumedMarkings: []
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function convertSecurityCondition(condition) {
|
|
166
|
+
switch (condition.type) {
|
|
167
|
+
case "and":
|
|
168
|
+
if ("conditions" in condition) {
|
|
169
|
+
return {
|
|
170
|
+
type: "and",
|
|
171
|
+
and: {
|
|
172
|
+
conditions: condition.conditions.map(c => convertSecurityCondition(c))
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
} else {
|
|
176
|
+
return condition;
|
|
177
|
+
}
|
|
178
|
+
case "or":
|
|
179
|
+
if ("conditions" in condition) {
|
|
180
|
+
return {
|
|
181
|
+
type: "or",
|
|
182
|
+
or: {
|
|
183
|
+
conditions: condition.conditions.map(c => convertSecurityCondition(c))
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
} else {
|
|
187
|
+
return condition;
|
|
188
|
+
}
|
|
189
|
+
case "markingProperty":
|
|
190
|
+
return {
|
|
191
|
+
type: "markings",
|
|
192
|
+
markings: {
|
|
193
|
+
property: condition.property
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
case "groupProperty":
|
|
197
|
+
return {
|
|
198
|
+
type: "comparison",
|
|
199
|
+
comparison: {
|
|
200
|
+
operator: "INTERSECTS",
|
|
201
|
+
left: {
|
|
202
|
+
type: "userProperty",
|
|
203
|
+
userProperty: {
|
|
204
|
+
type: "groupIds",
|
|
205
|
+
groupIds: {}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
right: {
|
|
209
|
+
type: "property",
|
|
210
|
+
property: condition.property
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
case "group":
|
|
215
|
+
return {
|
|
216
|
+
type: "comparison",
|
|
217
|
+
comparison: {
|
|
218
|
+
operator: "INTERSECTS",
|
|
219
|
+
left: {
|
|
220
|
+
type: "userProperty",
|
|
221
|
+
userProperty: {
|
|
222
|
+
type: "groupIds",
|
|
223
|
+
groupIds: {}
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
right: {
|
|
227
|
+
type: "constant",
|
|
228
|
+
constant: {
|
|
229
|
+
type: "strings",
|
|
230
|
+
strings: [condition.name]
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
default:
|
|
236
|
+
return condition;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
60
239
|
function buildPropertyMapping(properties) {
|
|
61
240
|
return Object.fromEntries(properties.map(prop => {
|
|
62
241
|
// editOnly
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertDatasourceDefinition.js","names":["convertDatasourceDefinition","objectType","properties","baseDatasource","datasources","find","ds","includes","type","window","retentionPeriod","retentionPolicy","time","none","propertyMapping","Object","fromEntries","map","prop","apiName","streamV2","streamLocator","propertySecurityGroups","undefined","restrictedViewV2","restrictedViewRid","buildPropertyMapping","datasetV2","datasetRid","editOnly","structMapping","struct","column","mapping","keys","structDefinition","fieldName","mappings"],"sources":["convertDatasourceDefinition.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\nimport type {\n OntologyIrObjectTypeDatasourceDefinition,\n PropertyTypeMappingInfo,\n RetentionPolicy,\n} from \"@osdk/client.unstable\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport type { ObjectType } from \"../../api/object/ObjectType.js\";\n\nexport function convertDatasourceDefinition(\n objectType: ObjectType,\n properties: ObjectPropertyType[],\n): OntologyIrObjectTypeDatasourceDefinition {\n const baseDatasource = objectType.datasources?.find(ds =>\n [\"dataset\", \"stream\", \"restrictedView\"].includes(ds.type)\n );\n switch (baseDatasource?.type) {\n case \"stream\":\n const window = baseDatasource.retentionPeriod;\n const retentionPolicy: RetentionPolicy = window\n ? { type: \"time\", time: { window } }\n : { type: \"none\", none: {} };\n const propertyMapping = Object.fromEntries(\n properties.map((\n prop,\n ) => [prop.apiName, prop.apiName]),\n );\n return {\n type: \"streamV2\",\n streamV2: {\n streamLocator: objectType.apiName,\n propertyMapping,\n retentionPolicy,\n propertySecurityGroups: undefined,\n },\n };\n case \"restrictedView\":\n return {\n type: \"restrictedViewV2\",\n restrictedViewV2: {\n restrictedViewRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n case \"dataset\":\n default:\n return {\n type: \"datasetV2\",\n datasetV2: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n }\n}\n\nfunction buildPropertyMapping(\n properties: ObjectPropertyType[],\n): Record<string, PropertyTypeMappingInfo> {\n return Object.fromEntries(\n properties.map((prop) => {\n // editOnly\n if (prop.editOnly) {\n return [prop.apiName, { type: \"editOnly\", editOnly: {} }];\n }\n // structs\n if (typeof prop.type === \"object\" && prop.type?.type === \"struct\") {\n const structMapping = {\n type: \"struct\",\n struct: {\n column: prop.apiName,\n mapping: Object.fromEntries(\n Object.keys(prop.type.structDefinition).map((fieldName) => [\n fieldName,\n { apiName: fieldName, mappings: {} },\n ]),\n ),\n },\n };\n return [prop.apiName, structMapping];\n }\n // default: column mapping\n return [prop.apiName, { type: \"column\", column: prop.apiName }];\n }),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,OAAO,SAASA,2BAA2BA,CACzCC,UAAsB,EACtBC,UAAgC,EACU;EAC1C,MAAMC,cAAc,GAAGF,UAAU,CAACG,WAAW,EAAEC,IAAI,CAACC,EAAE,IACpD,CAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAACC,QAAQ,CAACD,EAAE,CAACE,IAAI,CAC1D,CAAC;EACD,QAAQL,cAAc,EAAEK,IAAI;IAC1B,KAAK,QAAQ;MACX,MAAMC,MAAM,GAAGN,cAAc,CAACO,eAAe;MAC7C,MAAMC,eAAgC,GAAGF,MAAM,GAC3C;QAAED,IAAI,EAAE,MAAM;QAAEI,IAAI,EAAE;UAAEH;QAAO;MAAE,CAAC,GAClC;QAAED,IAAI,EAAE,MAAM;QAAEK,IAAI,EAAE,CAAC;MAAE,CAAC;MAC9B,MAAMC,eAAe,GAAGC,MAAM,CAACC,WAAW,CACxCd,UAAU,CAACe,GAAG,CACZC,IAAI,IACD,CAACA,IAAI,CAACC,OAAO,EAAED,IAAI,CAACC,OAAO,CAAC,CACnC,CAAC;MACD,OAAO;QACLX,IAAI,EAAE,UAAU;QAChBY,QAAQ,EAAE;UACRC,aAAa,EAAEpB,UAAU,CAACkB,OAAO;UACjCL,eAAe;UACfH,eAAe;UACfW,sBAAsB,EAAEC;QAC1B;MACF,CAAC;IACH,KAAK,gBAAgB;MACnB,OAAO;QACLf,IAAI,EAAE,kBAAkB;QACxBgB,gBAAgB,EAAE;UAChBC,iB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jE,CAAC,CACH,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"convertDatasourceDefinition.js","names":["invariant","convertDatasourceDefinition","objectType","properties","baseDatasource","datasources","find","ds","includes","type","window","retentionPeriod","retentionPolicy","time","none","propertyMapping","Object","fromEntries","map","prop","apiName","streamV2","streamLocator","propertySecurityGroups","undefined","restrictedViewV2","restrictedViewRid","buildPropertyMapping","datasetV2","datasetRid","some","objectSecurityPolicy","datasetV3","branchId","convertPropertySecurityGroups","primaryKeyPropertyApiName","groups","rid","security","granular","viewPolicy","granularPolicyCondition","and","conditions","additionalMandatory","markings","assumedMarkings","primaryKey","validPropertyNames","Set","usedProperties","forEach","psg","propertyName","has","process","env","NODE_ENV","name","add","objectSecurityPolicyGroup","convertGranularPolicy","granularPolicy","additionalMandatoryMarkings","filter","property","convertSecurityCondition","condition","c","or","comparison","operator","left","userProperty","groupIds","right","constant","strings","editOnly","structMapping","struct","column","mapping","keys","structDefinition","fieldName","mappings"],"sources":["convertDatasourceDefinition.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\nimport type {\n MarkingType,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrPropertySecurityGroup,\n OntologyIrPropertySecurityGroups,\n OntologyIrSecurityGroupGranularCondition,\n OntologyIrSecurityGroupGranularSecurityDefinition,\n PropertyTypeMappingInfo,\n RetentionPolicy,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport type { ObjectType } from \"../../api/object/ObjectType.js\";\nimport type { ObjectTypeDatasourceDefinition_dataset } from \"../../api/object/ObjectTypeDatasourceDefinition.js\";\nimport type { SecurityConditionDefinition } from \"../../api/object/SecurityCondition.js\";\n\nexport function convertDatasourceDefinition(\n objectType: ObjectType,\n properties: ObjectPropertyType[],\n): OntologyIrObjectTypeDatasourceDefinition {\n const baseDatasource = objectType.datasources?.find(ds =>\n [\"dataset\", \"stream\", \"restrictedView\"].includes(ds.type)\n );\n switch (baseDatasource?.type) {\n case \"stream\":\n const window = baseDatasource.retentionPeriod;\n const retentionPolicy: RetentionPolicy = window\n ? { type: \"time\", time: { window } }\n : { type: \"none\", none: {} };\n const propertyMapping = Object.fromEntries(\n properties.map((\n prop,\n ) => [prop.apiName, prop.apiName]),\n );\n return {\n type: \"streamV2\",\n streamV2: {\n streamLocator: objectType.apiName,\n propertyMapping,\n retentionPolicy,\n propertySecurityGroups: undefined,\n },\n };\n case \"restrictedView\":\n return {\n type: \"restrictedViewV2\",\n restrictedViewV2: {\n restrictedViewRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n case \"derived\":\n return {\n type: \"datasetV2\",\n datasetV2: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n case \"dataset\":\n default:\n if (\n objectType.properties?.some(prop =>\n typeof prop.type === \"object\" && prop.type.type === \"marking\"\n )\n || baseDatasource?.objectSecurityPolicy\n || baseDatasource?.propertySecurityGroups\n ) {\n return {\n type: \"datasetV3\",\n datasetV3: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n branchId: \"master\",\n propertySecurityGroups: convertPropertySecurityGroups(\n baseDatasource,\n properties,\n objectType.primaryKeyPropertyApiName,\n ),\n },\n };\n }\n return {\n type: \"datasetV2\",\n datasetV2: {\n datasetRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n },\n };\n }\n}\n\nfunction convertPropertySecurityGroups(\n ds: ObjectTypeDatasourceDefinition_dataset | undefined,\n properties: ObjectPropertyType[],\n primaryKeyPropertyApiName: string,\n): OntologyIrPropertySecurityGroups {\n if (\n !ds\n || (!(\"objectSecurityPolicy\" in ds) && !(\"propertySecurityGroups\" in ds))\n ) {\n return {\n groups: [\n {\n properties: properties.map(prop => prop.apiName),\n rid: \"defaultObjectSecurityPolicy\",\n security: {\n type: \"granular\",\n granular: {\n viewPolicy: {\n granularPolicyCondition: {\n type: \"and\",\n and: {\n conditions: [],\n },\n },\n additionalMandatory: {\n markings: {},\n assumedMarkings: [],\n },\n },\n },\n },\n type: {\n type: \"primaryKey\",\n primaryKey: {},\n },\n },\n ],\n };\n }\n\n const validPropertyNames = new Set(properties.map(prop => prop.apiName));\n const usedProperties = new Set();\n\n ds.propertySecurityGroups?.forEach(psg => {\n psg.properties.forEach(propertyName => {\n invariant(\n validPropertyNames.has(propertyName),\n `Property \"${propertyName}\" in property security group ${psg.name} does not exist in the properties list`,\n );\n invariant(\n !usedProperties.has(propertyName),\n `Property \"${propertyName}\" is used in multiple property security groups`,\n );\n invariant(\n propertyName !== primaryKeyPropertyApiName,\n `Property \"${propertyName}\" in property security group ${psg.name} cannot be the primary key`,\n );\n usedProperties.add(propertyName);\n });\n });\n\n const objectSecurityPolicyGroup: OntologyIrPropertySecurityGroup = {\n rid: ds.objectSecurityPolicy?.name || \"defaultObjectSecurityPolicy\",\n security: {\n type: \"granular\",\n granular: convertGranularPolicy(\n ds.objectSecurityPolicy?.granularPolicy,\n ds.objectSecurityPolicy?.additionalMandatoryMarkings,\n ),\n },\n type: {\n type: \"primaryKey\",\n primaryKey: {},\n },\n properties: properties\n .filter(prop => !usedProperties.has(prop.apiName))\n .map(prop => prop.apiName),\n };\n\n return {\n groups: [\n objectSecurityPolicyGroup,\n ...(ds.propertySecurityGroups?.map(psg => ({\n rid: psg.name,\n security: {\n type: \"granular\" as const,\n granular: convertGranularPolicy(\n psg.granularPolicy,\n psg.additionalMandatoryMarkings,\n ),\n },\n type: {\n type: \"property\" as const,\n property: {\n name: psg.name,\n },\n },\n properties: psg.properties ?? [],\n })) ?? []),\n ],\n };\n}\n\nfunction convertGranularPolicy(\n granularPolicy?: SecurityConditionDefinition,\n additionalMandatoryMarkings?: Record<string, MarkingType>,\n): OntologyIrSecurityGroupGranularSecurityDefinition {\n return {\n viewPolicy: {\n granularPolicyCondition: granularPolicy\n ? convertSecurityCondition(granularPolicy)\n : {\n type: \"and\",\n and: {\n conditions: [],\n },\n },\n additionalMandatory: {\n markings: additionalMandatoryMarkings ?? {},\n assumedMarkings: [],\n },\n },\n };\n}\n\nfunction convertSecurityCondition(\n condition: SecurityConditionDefinition,\n): OntologyIrSecurityGroupGranularCondition {\n switch (condition.type) {\n case \"and\":\n if (\"conditions\" in condition) {\n return {\n type: \"and\",\n and: {\n conditions: condition.conditions.map(c =>\n convertSecurityCondition(c)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"or\":\n if (\"conditions\" in condition) {\n return {\n type: \"or\",\n or: {\n conditions: condition.conditions.map(c =>\n convertSecurityCondition(c)\n ),\n },\n };\n } else {\n return condition;\n }\n case \"markingProperty\":\n return {\n type: \"markings\",\n markings: {\n property: condition.property,\n },\n };\n case \"groupProperty\":\n return {\n type: \"comparison\",\n comparison: {\n operator: \"INTERSECTS\",\n left: {\n type: \"userProperty\",\n userProperty: {\n type: \"groupIds\",\n groupIds: {},\n },\n },\n right: {\n type: \"property\",\n property: condition.property,\n },\n },\n };\n case \"group\":\n return {\n type: \"comparison\",\n comparison: {\n operator: \"INTERSECTS\",\n left: {\n type: \"userProperty\",\n userProperty: {\n type: \"groupIds\",\n groupIds: {},\n },\n },\n right: {\n type: \"constant\",\n constant: {\n type: \"strings\",\n strings: [\n condition.name,\n ],\n },\n },\n },\n };\n\n default:\n return condition;\n }\n}\n\nfunction buildPropertyMapping(\n properties: ObjectPropertyType[],\n): Record<string, PropertyTypeMappingInfo> {\n return Object.fromEntries(\n properties.map((prop) => {\n // editOnly\n if (prop.editOnly) {\n return [prop.apiName, { type: \"editOnly\", editOnly: {} }];\n }\n // structs\n if (typeof prop.type === \"object\" && prop.type?.type === \"struct\") {\n const structMapping = {\n type: \"struct\",\n struct: {\n column: prop.apiName,\n mapping: Object.fromEntries(\n Object.keys(prop.type.structDefinition).map((fieldName) => [\n fieldName,\n { apiName: fieldName, mappings: {} },\n ]),\n ),\n },\n };\n return [prop.apiName, structMapping];\n }\n // default: column mapping\n return [prop.apiName, { type: \"column\", column: prop.apiName }];\n }),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,OAAOA,SAAS,MAAM,gBAAgB;AAMtC,OAAO,SAASC,2BAA2BA,CACzCC,UAAsB,EACtBC,UAAgC,EACU;EAC1C,MAAMC,cAAc,GAAGF,UAAU,CAACG,WAAW,EAAEC,IAAI,CAACC,EAAE,IACpD,CAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAACC,QAAQ,CAACD,EAAE,CAACE,IAAI,CAC1D,CAAC;EACD,QAAQL,cAAc,EAAEK,IAAI;IAC1B,KAAK,QAAQ;MACX,MAAMC,MAAM,GAAGN,cAAc,CAACO,eAAe;MAC7C,MAAMC,eAAgC,GAAGF,MAAM,GAC3C;QAAED,IAAI,EAAE,MAAM;QAAEI,IAAI,EAAE;UAAEH;QAAO;MAAE,CAAC,GAClC;QAAED,IAAI,EAAE,MAAM;QAAEK,IAAI,EAAE,CAAC;MAAE,CAAC;MAC9B,MAAMC,eAAe,GAAGC,MAAM,CAACC,WAAW,CACxCd,UAAU,CAACe,GAAG,CACZC,IAAI,IACD,CAACA,IAAI,CAACC,OAAO,EAAED,IAAI,CAACC,OAAO,CAAC,CACnC,CAAC;MACD,OAAO;QACLX,IAAI,EAAE,UAAU;QAChBY,QAAQ,EAAE;UACRC,aAAa,EAAEpB,UAAU,CAACkB,OAAO;UACjCL,eAAe;UACfH,eAAe;UACfW,sBAAsB,E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mE,IAAI,CAAChE,IAAI,CAACV,IAAI,CAAC2E,gBAAgB,CAAC,CAAClE,GAAG,CAAEmE,SAAS,IAAK,CACzDA,SAAS,EACT;YAAEjE,OAAO,EAAEiE,SAAS;YAAEC,QAAQ,EAAE,CAAC;UAAE,CAAC,CACrC,CACH;QACF;MACF,CAAC;MACD,OAAO,CAACnE,IAAI,CAACC,OAAO,EAAE2D,aAAa,CAAC;IACtC;IACA;IACA,OAAO,CAAC5D,IAAI,CAACC,OAAO,EAAE;MAAEX,IAAI,EAAE,QAAQ;MAAEwE,MAAM,EAAE9D,IAAI,CAACC;IAAQ,CAAC,CAAC;EACjE,CAAC,CACH,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertNullabilityToDataConstraint.js","names":["invariant","convertNullabilityToDataConstraint","prop","type","nullability","undefined","propertyTypeConstraints","nullabilityV2","
|
|
1
|
+
{"version":3,"file":"convertNullabilityToDataConstraint.js","names":["invariant","convertNullabilityToDataConstraint","prop","type","nullability","undefined","propertyTypeConstraints","nullabilityV2","noNulls","process","env","NODE_ENV"],"sources":["convertNullabilityToDataConstraint.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\nimport type { DataConstraints } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type { Nullability } from \"../../api/properties/Nullability.js\";\nimport type { PropertyTypeType } from \"../../api/properties/PropertyTypeType.js\";\n\nexport function convertNullabilityToDataConstraint(\n prop: { type: PropertyTypeType; nullability?: Nullability },\n): DataConstraints | undefined {\n if (typeof prop.type === \"object\" && prop.type.type === \"marking\") {\n if (prop.nullability === undefined) {\n return {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: { noNulls: true },\n };\n }\n invariant(\n prop.nullability?.noNulls,\n \"Marking property type has noNulls set to false, marking properties must not be nullable\",\n );\n return {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: prop.nullability,\n };\n }\n return prop.nullability === undefined ? undefined : {\n propertyTypeConstraints: [],\n nullability: undefined,\n nullabilityV2: prop.nullability,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AAItC,OAAO,SAASC,kCAAkCA,CAChDC,IAA2D,EAC9B;EAC7B,IAAI,OAAOA,IAAI,CAACC,IAAI,KAAK,QAAQ,IAAID,IAAI,CAACC,IAAI,CAACA,IAAI,KAAK,SAAS,EAAE;IACjE,IAAID,IAAI,CAACE,WAAW,KAAKC,SAAS,EAAE;MAClC,OAAO;QACLC,uBAAuB,EAAE,EAAE;QAC3BF,WAAW,EAAEC,SAAS;QACtBE,aAAa,EAAE;UAAEC,OAAO,EAAE;QAAK;MACjC,CAAC;IACH;IACA,CACEN,IAAI,CAACE,WAAW,EAAEI,OAAO,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAD3BX,SAAS,QAEP,yFAAyF,IAF3FA,SAAS;IAIT,OAAO;MACLM,uBAAuB,EAAE,EAAE;MAC3BF,WAAW,EAAEC,SAAS;MACtBE,aAAa,EAAEL,IAAI,CAACE;IACtB,CAAC;EACH;EACA,OAAOF,IAAI,CAACE,WAAW,KAAKC,SAAS,GAAGA,SAAS,GAAG;IAClDC,uBAAuB,EAAE,EAAE;IAC3BF,WAAW,EAAEC,SAAS;IACtBE,aAAa,EAAEL,IAAI,CAACE;EACtB,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertObject.js","names":["buildDatasource","cleanAndValidateLinkTypeId","convertObjectStatus","isExotic","convertDatasourceDefinition","convertObjectPropertyType","convertObject","objectType","derivedDatasources","derivedPropertyNames","extractDerivedDatasources","propertyDatasources","properties","filter","prop","includes","apiName","flatMap","extractPropertyDatasource","classificationGroupMarkingNames","extractMarkingGroups","mandatoryMarkingNames","classificationInputGroup","length","reduce","l","r","undefined","mandatoryInputGroup","objectDatasource","implementations","implementsInterfaces","displayMetadata","description","displayName","groupDisplayName","icon","type","blueprint","locator","color","pluralDisplayName","visibility","primaryKeys","primaryKeyPropertyApiName","propertyTypes","Object","fromEntries","map","val","titlePropertyTypeRid","titlePropertyApiName","status","redacted","implementsInterfaces2","impl","interfaceTypeApiName","implements","linksV2","propertiesV2","propertyMapping","mappings","interfaceProperty","propertyTypeRid","mapsTo","allImplementsInterfaces","datasources","entityMetadata","arePatchesEnabled","editsEnabled","aliases","markingType","markingInputGroupName","property","objectTypeApiName","identifier","geotimeDefinition","geotimeSeries","geotimeSeriesIntegrationRid","mediaSetDefinition","mediaSetView","assumedMarkings","mediaSetViewLocator","uploadProperties","inputDerivedDatasources","ds","i","buildDerivedDatasource","keys","datasource","index","linkDefinition","multiHopLink","steps","step","searchAround","linkTypeIdentifier","linkType","linkTypeSide","side","isLinkedProperties","values","derivedDefinition","linkedProperties","propertyTypeMapping","entries","sourceProp","targetProp","propertyType","aggregatedProperties","agg","buildAggregation","toString","derived","definition","limit","foreignProperty","innerDef"],"sources":["convertObject.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\nimport type {\n OntologyIrDerivedPropertiesDefinition,\n OntologyIrDerivedPropertyAggregation,\n OntologyIrObjectTypeBlockDataV2,\n OntologyIrObjectTypeDatasource,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrPropertyType,\n} from \"@osdk/client.unstable\";\nimport {\n buildDatasource,\n cleanAndValidateLinkTypeId,\n convertObjectStatus,\n} from \"../../api/defineOntology.js\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport type { ObjectType } from \"../../api/object/ObjectType.js\";\nimport type {\n DerivedPropertyAggregation,\n ObjectTypeDatasourceDefinition_derived,\n} from \"../../api/object/ObjectTypeDatasourceDefinition.js\";\nimport { isExotic } from \"../../api/properties/PropertyTypeType.js\";\nimport { convertDatasourceDefinition } from \"./convertDatasourceDefinition.js\";\nimport { convertObjectPropertyType } from \"./convertObjectPropertyType.js\";\n\nexport function convertObject(\n objectType: ObjectType,\n): OntologyIrObjectTypeBlockDataV2 {\n const { derivedDatasources, derivedPropertyNames } =\n extractDerivedDatasources(objectType);\n\n const propertyDatasources: OntologyIrObjectTypeDatasource[] =\n (objectType.properties ?? [])\n .filter(prop => !derivedPropertyNames.includes(prop.apiName))\n .flatMap(prop => extractPropertyDatasource(prop, objectType.apiName));\n\n const classificationGroupMarkingNames = extractMarkingGroups(\n objectType.properties ?? [],\n \"CBAC\",\n );\n\n const mandatoryMarkingNames = extractMarkingGroups(\n objectType.properties ?? [],\n \"MANDATORY\",\n );\n\n const classificationInputGroup = classificationGroupMarkingNames.length > 0\n ? classificationGroupMarkingNames.reduce((l, r) => l + \"/\" + r)\n : undefined;\n\n const mandatoryInputGroup = mandatoryMarkingNames.length > 0\n ? mandatoryMarkingNames.reduce((l, r) => l + \"/\" + r)\n : undefined;\n\n const objectDatasource = buildDatasource(\n objectType.apiName,\n convertDatasourceDefinition(\n objectType,\n (objectType.properties ?? []).filter(prop =>\n !derivedPropertyNames.includes(prop.apiName)\n ),\n ),\n classificationInputGroup,\n mandatoryInputGroup,\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.primaryKeyPropertyApiName],\n propertyTypes: Object.fromEntries(\n objectType.properties?.map<[string, OntologyIrPropertyType]>(\n val => [val.apiName, convertObjectPropertyType(val)],\n ) ?? [],\n ),\n titlePropertyTypeRid: objectType.titlePropertyApiName,\n apiName: objectType.apiName,\n status: convertObjectStatus(objectType.status),\n redacted: false,\n implementsInterfaces2: implementations.map(impl => ({\n interfaceTypeApiName: impl.implements.apiName,\n linksV2: {},\n propertiesV2: Object.fromEntries(impl.propertyMapping\n .map(\n mappings => [mappings.interfaceProperty, {\n type: \"propertyTypeRid\",\n propertyTypeRid: mappings.mapsTo,\n }],\n )),\n properties: {},\n })),\n allImplementsInterfaces: {},\n },\n datasources: [\n ...propertyDatasources,\n ...derivedDatasources,\n objectDatasource,\n ],\n entityMetadata: {\n arePatchesEnabled: objectType.editsEnabled ?? false,\n aliases: objectType.aliases ?? [],\n },\n };\n}\n\n/**\n * Extracts marking group names of a specific type from object properties\n */\nexport function extractMarkingGroups(\n properties: ObjectPropertyType[],\n markingType: \"CBAC\" | \"MANDATORY\",\n): string[] {\n return properties\n .map(prop => {\n if (\n typeof prop.type === \"object\"\n && prop.type.type === \"marking\"\n && prop.type.markingType === markingType\n ) {\n return prop.type.markingInputGroupName;\n }\n return undefined;\n })\n .filter((val): val is string => val !== undefined);\n}\nexport function extractPropertyDatasource(\n property: ObjectPropertyType,\n objectTypeApiName: string,\n): OntologyIrObjectTypeDatasource[] {\n if (!isExotic(property.type)) {\n return [];\n }\n const identifier = objectTypeApiName + \".\" + property.apiName;\n switch (property.type as string) {\n case \"geotimeSeries\":\n const geotimeDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"geotimeSeries\",\n geotimeSeries: {\n geotimeSeriesIntegrationRid: identifier,\n properties: [property.apiName],\n },\n };\n return [buildDatasource(property.apiName, geotimeDefinition)];\n case \"mediaReference\":\n const mediaSetDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"mediaSetView\",\n mediaSetView: {\n assumedMarkings: [],\n mediaSetViewLocator: identifier,\n properties: [property.apiName],\n uploadProperties: [],\n },\n };\n return [buildDatasource(property.apiName, mediaSetDefinition)];\n default:\n return [];\n }\n}\n\nfunction extractDerivedDatasources(\n objectType: ObjectType,\n): {\n derivedDatasources: OntologyIrObjectTypeDatasource[];\n derivedPropertyNames: string[];\n} {\n const inputDerivedDatasources = (objectType.datasources ?? []).filter(ds =>\n ds.type === \"derived\"\n );\n const derivedDatasources = inputDerivedDatasources.map((ds, i) =>\n buildDerivedDatasource(ds, i, objectType.apiName)\n );\n const derivedPropertyNames = inputDerivedDatasources.flatMap(ds =>\n Object.keys(ds.propertyMapping)\n );\n return { derivedDatasources, derivedPropertyNames };\n}\n\nfunction buildDerivedDatasource(\n datasource: ObjectTypeDatasourceDefinition_derived,\n index: number,\n objectTypeApiName: string,\n): OntologyIrObjectTypeDatasource {\n const linkDefinition = {\n type: \"multiHopLink\",\n multiHopLink: {\n steps: datasource.linkDefinition.map(step => ({\n type: \"searchAround\",\n searchAround: {\n linkTypeIdentifier: {\n type: \"linkType\",\n linkType: cleanAndValidateLinkTypeId(step.linkType.apiName),\n },\n linkTypeSide: step.side ?? \"SOURCE\",\n },\n })),\n },\n };\n\n const isLinkedProperties =\n typeof Object.values(datasource.propertyMapping)[0] === \"string\";\n const derivedDefinition = isLinkedProperties\n ? {\n type: \"linkedProperties\",\n linkedProperties: {\n linkDefinition,\n propertyTypeMapping: Object.fromEntries(\n Object.entries(datasource.propertyMapping).map((\n [sourceProp, targetProp],\n ) => [sourceProp, {\n type: \"propertyType\",\n propertyType: targetProp,\n }]),\n ),\n },\n }\n : {\n type: \"aggregatedProperties\",\n aggregatedProperties: {\n linkDefinition,\n propertyTypeMapping: Object.fromEntries(\n Object.entries(datasource.propertyMapping).map((\n [sourceProp, agg],\n ) => [sourceProp, buildAggregation(agg)]),\n ),\n },\n };\n const fullDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"derived\",\n derived: {\n definition: derivedDefinition as OntologyIrDerivedPropertiesDefinition,\n },\n };\n return buildDatasource(\n objectTypeApiName + \".derived.\" + index.toString(),\n fullDefinition,\n );\n}\n\nfunction buildAggregation(\n agg: DerivedPropertyAggregation,\n): OntologyIrDerivedPropertyAggregation {\n const type = agg.type;\n const limit = \"limit\" in agg ? agg.limit : undefined;\n const foreignProperty = \"property\" in agg ? agg.property : undefined;\n const innerDef: any = {};\n if (type !== \"count\") {\n if ([\"collectList\", \"collectSet\"].includes(type)) {\n innerDef[\"linkedProperty\"] = {\n type: \"propertyType\",\n propertyType: foreignProperty,\n };\n innerDef[\"limit\"] = limit;\n } else {\n innerDef[\"property\"] = {\n type: \"propertyType\",\n propertyType: foreignProperty,\n };\n }\n }\n return {\n type,\n [type]: innerDef,\n } as unknown as OntologyIrDerivedPropertyAggregation;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SACEA,eAAe,EACfC,0BAA0B,EAC1BC,mBAAmB,QACd,6BAA6B;AAOpC,SAASC,QAAQ,QAAQ,0CAA0C;AACnE,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,yBAAyB,QAAQ,gCAAgC;AAE1E,OAAO,SAASC,aAAaA,CAC3BC,UAAsB,EACW;EACjC,MAAM;IAAEC,kBAAkB;IAAEC;EAAqB,CAAC,GAChDC,yBAAyB,CAACH,UAAU,CAAC;EAEvC,MAAMI,mBAAqD,GACzD,CAAC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S;EACpD,MAAMyF,eAAe,GAAG,UAAU,IAAIN,GAAG,GAAGA,GAAG,CAACrC,QAAQ,GAAG9C,SAAS;EACpE,MAAM0F,QAAa,GAAG,CAAC,CAAC;EACxB,IAAIhF,IAAI,KAAK,OAAO,EAAE;IACpB,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAACtB,QAAQ,CAACsB,IAAI,CAAC,EAAE;MAChDgF,QAAQ,CAAC,gBAAgB,CAAC,GAAG;QAC3BhF,IAAI,EAAE,cAAc;QACpBuE,YAAY,EAAEQ;MAChB,CAAC;MACDC,QAAQ,CAAC,OAAO,CAAC,GAAGF,KAAK;IAC3B,CAAC,MAAM;MACLE,QAAQ,CAAC,UAAU,CAAC,GAAG;QACrBhF,IAAI,EAAE,cAAc;QACpBuE,YAAY,EAAEQ;MAChB,CAAC;IACH;EACF;EACA,OAAO;IACL/E,IAAI;IACJ,CAACA,IAAI,GAAGgF;EACV,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"convertObject.js","names":["buildDatasource","cleanAndValidateLinkTypeId","convertObjectStatus","isExotic","convertDatasourceDefinition","convertObjectPropertyType","convertObject","objectType","derivedDatasources","derivedPropertyNames","extractDerivedDatasources","propertyDatasources","properties","filter","prop","includes","apiName","flatMap","extractPropertyDatasource","classificationGroupMarkingNames","extractMarkingGroups","mandatoryMarkingNames","classificationInputGroup","length","reduce","l","r","undefined","mandatoryInputGroup","objectDatasource","implementations","implementsInterfaces","displayMetadata","description","displayName","groupDisplayName","icon","type","blueprint","locator","color","pluralDisplayName","visibility","primaryKeys","primaryKeyPropertyApiName","propertyTypes","Object","fromEntries","map","val","titlePropertyTypeRid","titlePropertyApiName","status","redacted","implementsInterfaces2","impl","interfaceTypeApiName","implements","linksV2","propertiesV2","propertyMapping","mappings","interfaceProperty","propertyTypeRid","mapsTo","allImplementsInterfaces","datasources","entityMetadata","arePatchesEnabled","editsEnabled","aliases","propertySecurityGroupPackagingVersion","v2","markingType","markingInputGroupName","property","objectTypeApiName","identifier","geotimeDefinition","geotimeSeries","geotimeSeriesIntegrationRid","mediaSetDefinition","mediaSetView","assumedMarkings","mediaSetViewLocator","uploadProperties","inputDerivedDatasources","ds","i","buildDerivedDatasource","keys","datasource","index","linkDefinition","multiHopLink","steps","step","searchAround","linkTypeIdentifier","linkType","linkTypeSide","side","isLinkedProperties","values","derivedDefinition","linkedProperties","propertyTypeMapping","entries","sourceProp","targetProp","propertyType","aggregatedProperties","agg","buildAggregation","toString","derived","definition","limit","foreignProperty","innerDef"],"sources":["convertObject.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\nimport type {\n OntologyIrDerivedPropertiesDefinition,\n OntologyIrDerivedPropertyAggregation,\n OntologyIrObjectTypeBlockDataV2,\n OntologyIrObjectTypeDatasource,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrPropertyType,\n} from \"@osdk/client.unstable\";\nimport {\n buildDatasource,\n cleanAndValidateLinkTypeId,\n convertObjectStatus,\n} from \"../../api/defineOntology.js\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport type { ObjectType } from \"../../api/object/ObjectType.js\";\nimport type {\n DerivedPropertyAggregation,\n ObjectTypeDatasourceDefinition_derived,\n} from \"../../api/object/ObjectTypeDatasourceDefinition.js\";\nimport { isExotic } from \"../../api/properties/PropertyTypeType.js\";\nimport { convertDatasourceDefinition } from \"./convertDatasourceDefinition.js\";\nimport { convertObjectPropertyType } from \"./convertObjectPropertyType.js\";\n\nexport function convertObject(\n objectType: ObjectType,\n): OntologyIrObjectTypeBlockDataV2 {\n const { derivedDatasources, derivedPropertyNames } =\n extractDerivedDatasources(objectType);\n\n const propertyDatasources: OntologyIrObjectTypeDatasource[] =\n (objectType.properties ?? [])\n .filter(prop => !derivedPropertyNames.includes(prop.apiName))\n .flatMap(prop => extractPropertyDatasource(prop, objectType.apiName));\n\n const classificationGroupMarkingNames = extractMarkingGroups(\n objectType.properties ?? [],\n \"CBAC\",\n );\n\n const mandatoryMarkingNames = extractMarkingGroups(\n objectType.properties ?? [],\n \"MANDATORY\",\n );\n\n const classificationInputGroup = classificationGroupMarkingNames.length > 0\n ? classificationGroupMarkingNames.reduce((l, r) => l + \"/\" + r)\n : undefined;\n\n const mandatoryInputGroup = mandatoryMarkingNames.length > 0\n ? mandatoryMarkingNames.reduce((l, r) => l + \"/\" + r)\n : undefined;\n\n const objectDatasource = buildDatasource(\n objectType.apiName,\n convertDatasourceDefinition(\n objectType,\n (objectType.properties ?? []).filter(prop =>\n !derivedPropertyNames.includes(prop.apiName)\n ),\n ),\n classificationInputGroup,\n mandatoryInputGroup,\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.primaryKeyPropertyApiName],\n propertyTypes: Object.fromEntries(\n objectType.properties?.map<[string, OntologyIrPropertyType]>(\n val => [val.apiName, convertObjectPropertyType(val)],\n ) ?? [],\n ),\n titlePropertyTypeRid: objectType.titlePropertyApiName,\n apiName: objectType.apiName,\n status: convertObjectStatus(objectType.status),\n redacted: false,\n implementsInterfaces2: implementations.map(impl => ({\n interfaceTypeApiName: impl.implements.apiName,\n linksV2: {},\n propertiesV2: Object.fromEntries(impl.propertyMapping\n .map(\n mappings => [mappings.interfaceProperty, {\n type: \"propertyTypeRid\",\n propertyTypeRid: mappings.mapsTo,\n }],\n )),\n properties: {},\n })),\n allImplementsInterfaces: {},\n },\n datasources: [\n ...propertyDatasources,\n ...derivedDatasources,\n objectDatasource,\n ],\n entityMetadata: {\n arePatchesEnabled: objectType.editsEnabled ?? false,\n aliases: objectType.aliases ?? [],\n },\n propertySecurityGroupPackagingVersion: {\n type: \"v2\",\n v2: {},\n },\n };\n}\n\n/**\n * Extracts marking group names of a specific type from object properties\n */\nexport function extractMarkingGroups(\n properties: ObjectPropertyType[],\n markingType: \"CBAC\" | \"MANDATORY\",\n): string[] {\n return properties\n .map(prop => {\n if (\n typeof prop.type === \"object\"\n && prop.type.type === \"marking\"\n && prop.type.markingType === markingType\n ) {\n return prop.type.markingInputGroupName;\n }\n return undefined;\n })\n .filter((val): val is string => val !== undefined);\n}\nexport function extractPropertyDatasource(\n property: ObjectPropertyType,\n objectTypeApiName: string,\n): OntologyIrObjectTypeDatasource[] {\n if (!isExotic(property.type)) {\n return [];\n }\n const identifier = objectTypeApiName + \".\" + property.apiName;\n switch (property.type as string) {\n case \"geotimeSeries\":\n const geotimeDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"geotimeSeries\",\n geotimeSeries: {\n geotimeSeriesIntegrationRid: identifier,\n properties: [property.apiName],\n },\n };\n return [buildDatasource(property.apiName, geotimeDefinition)];\n case \"mediaReference\":\n const mediaSetDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"mediaSetView\",\n mediaSetView: {\n assumedMarkings: [],\n mediaSetViewLocator: identifier,\n properties: [property.apiName],\n uploadProperties: [],\n },\n };\n return [buildDatasource(property.apiName, mediaSetDefinition)];\n default:\n return [];\n }\n}\n\nfunction extractDerivedDatasources(\n objectType: ObjectType,\n): {\n derivedDatasources: OntologyIrObjectTypeDatasource[];\n derivedPropertyNames: string[];\n} {\n const inputDerivedDatasources = (objectType.datasources ?? []).filter(ds =>\n ds.type === \"derived\"\n );\n const derivedDatasources = inputDerivedDatasources.map((ds, i) =>\n buildDerivedDatasource(ds, i, objectType.apiName)\n );\n const derivedPropertyNames = inputDerivedDatasources.flatMap(ds =>\n Object.keys(ds.propertyMapping)\n );\n return { derivedDatasources, derivedPropertyNames };\n}\n\nfunction buildDerivedDatasource(\n datasource: ObjectTypeDatasourceDefinition_derived,\n index: number,\n objectTypeApiName: string,\n): OntologyIrObjectTypeDatasource {\n const linkDefinition = {\n type: \"multiHopLink\",\n multiHopLink: {\n steps: datasource.linkDefinition.map(step => ({\n type: \"searchAround\",\n searchAround: {\n linkTypeIdentifier: {\n type: \"linkType\",\n linkType: cleanAndValidateLinkTypeId(step.linkType.apiName),\n },\n linkTypeSide: step.side ?? \"SOURCE\",\n },\n })),\n },\n };\n\n const isLinkedProperties =\n typeof Object.values(datasource.propertyMapping)[0] === \"string\";\n const derivedDefinition = isLinkedProperties\n ? {\n type: \"linkedProperties\",\n linkedProperties: {\n linkDefinition,\n propertyTypeMapping: Object.fromEntries(\n Object.entries(datasource.propertyMapping).map((\n [sourceProp, targetProp],\n ) => [sourceProp, {\n type: \"propertyType\",\n propertyType: targetProp,\n }]),\n ),\n },\n }\n : {\n type: \"aggregatedProperties\",\n aggregatedProperties: {\n linkDefinition,\n propertyTypeMapping: Object.fromEntries(\n Object.entries(datasource.propertyMapping).map((\n [sourceProp, agg],\n ) => [sourceProp, buildAggregation(agg)]),\n ),\n },\n };\n const fullDefinition: OntologyIrObjectTypeDatasourceDefinition = {\n type: \"derived\",\n derived: {\n definition: derivedDefinition as OntologyIrDerivedPropertiesDefinition,\n },\n };\n return buildDatasource(\n objectTypeApiName + \".derived.\" + index.toString(),\n fullDefinition,\n );\n}\n\nfunction buildAggregation(\n agg: DerivedPropertyAggregation,\n): OntologyIrDerivedPropertyAggregation {\n const type = agg.type;\n const limit = \"limit\" in agg ? agg.limit : undefined;\n const foreignProperty = \"property\" in agg ? agg.property : undefined;\n const innerDef: any = {};\n if (type !== \"count\") {\n if ([\"collectList\", \"collectSet\"].includes(type)) {\n innerDef[\"linkedProperty\"] = {\n type: \"propertyType\",\n propertyType: foreignProperty,\n };\n innerDef[\"limit\"] = limit;\n } else {\n innerDef[\"property\"] = {\n type: \"propertyType\",\n propertyType: foreignProperty,\n };\n }\n }\n return {\n type,\n [type]: innerDef,\n } as unknown as OntologyIrDerivedPropertyAggregation;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SACEA,eAAe,EACfC,0BAA0B,EAC1BC,mBAAmB,QACd,6BAA6B;AAOpC,SAASC,QAAQ,QAAQ,0CAA0C;AACnE,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,yBAAyB,QAAQ,gCAAgC;AAE1E,OAAO,SAASC,aAAaA,CAC3BC,UAAsB,EACW;EACjC,MAAM;IAAEC,kBAAkB;IAAEC;EAAqB,CAAC,GAChDC,yBAAyB,CAACH,UAAU,CAAC;EAEvC,MAAMI,mBAAqD,GACzD,CAACJ,UAAU,CAACK,UAAU,IAAI,EAAE,EACzBC,MAAM,CAACC,IAAI,IAAI,CAACL,oBAAoB,CAACM,QAAQ,CAACD,IAAI,CAACE,OAAO,CAAC,CAAC,CAC5DC,OAAO,CAACH,IAAI,IAAII,yBAAyB,CAACJ,IAAI,EAAEP,UAAU,CAACS,OAAO,CAAC,CAAC;EAEzE,MAAMG,+BAA+B,GAAGC,oBAAoB,CAC1Db,UAAU,CAACK,UAAU,IAAI,EAAE,EAC3B,MACF,CAAC;EAED,MAAMS,qBAAqB,GAAGD,oBAAoB,CAChDb,UAAU,CAACK,UAAU,IAAI,EAAE,EAC3B,WACF,CAAC;EAED,MAAMU,wBAAwB,GAAGH,+BAA+B,CAACI,MAAM,GAAG,CAAC,GACvEJ,+BAA+B,CAACK,MAAM,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,GAAG,GAAG,GAAGC,CAAC,CA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;QACpByE,YAAY,EAAEQ;MAChB,CAAC;IACH;EACF;EACA,OAAO;IACLjF,IAAI;IACJ,CAACA,IAAI,GAAGkF;EACV,CAAC;AACH","ignoreList":[]}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import invariant from "tiny-invariant";
|
|
18
18
|
import { convertObjectStatus, namespace } from "../../api/defineOntology.js";
|
|
19
|
-
import { defaultTypeClasses, getPropertyTypeName, hasRenderHints, shouldNotHaveRenderHints } from "../../api/propertyConversionUtils.js";
|
|
19
|
+
import { defaultTypeClasses, getPropertyTypeName, hasRenderHints, shouldBeIndexedForSearch, shouldNotHaveRenderHints } from "../../api/propertyConversionUtils.js";
|
|
20
20
|
import { convertNullabilityToDataConstraint } from "./convertNullabilityToDataConstraint.js";
|
|
21
21
|
import { convertValueType } from "./convertValueType.js";
|
|
22
22
|
import { convertValueTypeDataConstraints } from "./convertValueTypeDataConstraints.js";
|
|
@@ -32,7 +32,7 @@ export function convertObjectPropertyType(property) {
|
|
|
32
32
|
description: property.description,
|
|
33
33
|
visibility: property.visibility ?? "NORMAL"
|
|
34
34
|
},
|
|
35
|
-
indexedForSearch: property.indexedForSearch ??
|
|
35
|
+
indexedForSearch: property.indexedForSearch ?? shouldBeIndexedForSearch(property.type),
|
|
36
36
|
ruleSetBinding: undefined,
|
|
37
37
|
baseFormatter: property.baseFormatter,
|
|
38
38
|
type: property.array ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertObjectPropertyType.js","names":["invariant","convertObjectStatus","namespace","defaultTypeClasses","getPropertyTypeName","hasRenderHints","shouldNotHaveRenderHints","convertNullabilityToDataConstraint","convertValueType","convertValueTypeDataConstraints","propertyTypeTypeToOntologyIrType","convertObjectPropertyType","property","apiName","type","typeClasses","process","env","NODE_ENV","output","sharedPropertyTypeApiName","sharedPropertyType","displayMetadata","displayName","description","visibility","indexedForSearch","ruleSetBinding","undefined","baseFormatter","array","subtype","reducers","status","inlineAction","dataConstraints","valueType","constraints","sharedPropertyTypeRid"],"sources":["convertObjectPropertyType.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\nimport type { OntologyIrPropertyType } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { convertObjectStatus, namespace } from \"../../api/defineOntology.js\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport {\n defaultTypeClasses,\n getPropertyTypeName,\n hasRenderHints,\n shouldNotHaveRenderHints,\n} from \"../../api/propertyConversionUtils.js\";\nimport { convertNullabilityToDataConstraint } from \"./convertNullabilityToDataConstraint.js\";\nimport { convertValueType } from \"./convertValueType.js\";\nimport { convertValueTypeDataConstraints } from \"./convertValueTypeDataConstraints.js\";\nimport { propertyTypeTypeToOntologyIrType } from \"./propertyTypeTypeToOntologyIrType.js\";\n\nexport function convertObjectPropertyType(\n property: ObjectPropertyType,\n): OntologyIrPropertyType {\n const apiName = namespace + property.apiName;\n invariant(\n !shouldNotHaveRenderHints(property.type)\n || !hasRenderHints(property.typeClasses),\n `Property type ${apiName} of type '${\n getPropertyTypeName(property.type)\n }' should not have render hints`,\n );\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
|
|
1
|
+
{"version":3,"file":"convertObjectPropertyType.js","names":["invariant","convertObjectStatus","namespace","defaultTypeClasses","getPropertyTypeName","hasRenderHints","shouldBeIndexedForSearch","shouldNotHaveRenderHints","convertNullabilityToDataConstraint","convertValueType","convertValueTypeDataConstraints","propertyTypeTypeToOntologyIrType","convertObjectPropertyType","property","apiName","type","typeClasses","process","env","NODE_ENV","output","sharedPropertyTypeApiName","sharedPropertyType","displayMetadata","displayName","description","visibility","indexedForSearch","ruleSetBinding","undefined","baseFormatter","array","subtype","reducers","status","inlineAction","dataConstraints","valueType","constraints","sharedPropertyTypeRid"],"sources":["convertObjectPropertyType.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\nimport type { OntologyIrPropertyType } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { convertObjectStatus, namespace } from \"../../api/defineOntology.js\";\nimport type { ObjectPropertyType } from \"../../api/object/ObjectPropertyType.js\";\nimport {\n defaultTypeClasses,\n getPropertyTypeName,\n hasRenderHints,\n shouldBeIndexedForSearch,\n shouldNotHaveRenderHints,\n} from \"../../api/propertyConversionUtils.js\";\nimport { convertNullabilityToDataConstraint } from \"./convertNullabilityToDataConstraint.js\";\nimport { convertValueType } from \"./convertValueType.js\";\nimport { convertValueTypeDataConstraints } from \"./convertValueTypeDataConstraints.js\";\nimport { propertyTypeTypeToOntologyIrType } from \"./propertyTypeTypeToOntologyIrType.js\";\n\nexport function convertObjectPropertyType(\n property: ObjectPropertyType,\n): OntologyIrPropertyType {\n const apiName = namespace + property.apiName;\n invariant(\n !shouldNotHaveRenderHints(property.type)\n || !hasRenderHints(property.typeClasses),\n `Property type ${apiName} of type '${\n getPropertyTypeName(property.type)\n }' should not have render hints`,\n );\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\n ?? shouldBeIndexedForSearch(property.type),\n ruleSetBinding: undefined,\n baseFormatter: property.baseFormatter,\n type: property.array\n ? {\n type: \"array\" as const,\n array: {\n subtype: propertyTypeTypeToOntologyIrType(property.type),\n reducers: [],\n },\n }\n : propertyTypeTypeToOntologyIrType(property.type),\n typeClasses: property.typeClasses\n ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),\n status: convertObjectStatus(property.status),\n inlineAction: undefined,\n dataConstraints: property.valueType\n ? convertValueTypeDataConstraints(property.valueType.constraints)\n : convertNullabilityToDataConstraint(property),\n sharedPropertyTypeRid: property.sharedPropertyType?.apiName,\n valueType: property.valueType\n ? convertValueType(property.valueType)\n : undefined,\n };\n return output;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,mBAAmB,EAAEC,SAAS,QAAQ,6BAA6B;AAE5E,SACEC,kBAAkB,EAClBC,mBAAmB,EACnBC,cAAc,EACdC,wBAAwB,EACxBC,wBAAwB,QACnB,sCAAsC;AAC7C,SAASC,kCAAkC,QAAQ,yCAAyC;AAC5F,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,+BAA+B,QAAQ,sCAAsC;AACtF,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,OAAO,SAASC,yBAAyBA,CACvCC,QAA4B,EACJ;EACxB,MAAMC,OAAO,GAAGZ,SAAS,GAAGW,QAAQ,CAACC,OAAO;EAC5C,EACE,CAACP,wBAAwB,CAACM,QAAQ,CAACE,IAAI,CAAC,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IAChD0B,qBAAqB,EAAE1B,QAAQ,CAACS,kBAAkB,EAAER,OAAO;IAC3DuB,SAAS,EAAExB,QAAQ,CAACwB,SAAS,GACzB5B,gBAAgB,CAACI,QAAQ,CAACwB,SAAS,CAAC,GACpCR;EACN,CAAC;EACD,OAAOT,MAAM;AACf","ignoreList":[]}
|
|
@@ -129,6 +129,11 @@ export function propertyTypeTypeToOntologyIrType(type) {
|
|
|
129
129
|
type: "geotimeSeriesReference",
|
|
130
130
|
geotimeSeriesReference: {}
|
|
131
131
|
};
|
|
132
|
+
case type === "attachment":
|
|
133
|
+
return {
|
|
134
|
+
type: "attachment",
|
|
135
|
+
attachment: {}
|
|
136
|
+
};
|
|
132
137
|
default:
|
|
133
138
|
// use helper function to distribute `type` properly
|
|
134
139
|
if (typeof type === "object") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTypeTypeToOntologyIrType.js","names":["distributeTypeHelper","propertyTypeTypeToOntologyIrType","type","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","field","apiName","displayMetadata","displayName","description","undefined","typeClasses","aliases","fieldType","push","struct","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","supportsFullTextRegex","precision","scale","geohash","mediaReference","geotimeSeriesReference","Error","JSON","stringify"],"sources":["propertyTypeTypeToOntologyIrType.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\nimport type {\n OntologyIrStructFieldType,\n OntologyIrType,\n} from \"@osdk/client.unstable\";\nimport type { PropertyTypeType } from \"../../api/properties/PropertyTypeType.js\";\nimport { distributeTypeHelper } from \"../toConjure/distributeTypeHelper.js\";\n\nexport function propertyTypeTypeToOntologyIrType(\n type: PropertyTypeType,\n): OntologyIrType {\n switch (true) {\n case (typeof type === \"object\" && type.type === \"marking\"):\n return {\n \"type\": \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case (typeof type === \"object\" && type.type === \"struct\"):\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: propertyTypeTypeToOntologyIrType(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: propertyTypeTypeToOntologyIrType(\n fieldTypeDefinition.fieldType,\n ),\n displayMetadata: fieldTypeDefinition.displayMetadata\n ?? { displayName: key, description: undefined },\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: propertyTypeTypeToOntologyIrType(fieldTypeDefinition),\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: { structFields },\n };\n\n case (typeof type === \"object\" && type.type === \"string\"):\n return {\n \"type\": \"string\",\n \"string\": {\n analyzerOverride: undefined,\n enableAsciiFolding: type.enableAsciiFolding,\n isLongText: type.isLongText ?? false,\n supportsEfficientLeadingWildcard:\n type.supportsEfficientLeadingWildcard ?? false,\n supportsExactMatching: type.supportsExactMatching ?? true,\n supportsFullTextRegex: type.supportsFullTextRegex,\n },\n };\n\n case (typeof type === \"object\" && type.type === \"decimal\"):\n return {\n \"type\": \"decimal\",\n \"decimal\": {\n precision: type.precision,\n scale: type.scale,\n },\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 case (type === \"geotimeSeries\"):\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n if (typeof type === \"object\") {\n throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);\n }\n return distributeTypeHelper(type);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,oBAAoB,QAAQ,sCAAsC;AAE3E,OAAO,SAASC,gCAAgCA,CAC9CC,IAAsB,EACN;EAChB,QAAQ,IAAI;IACV,KAAM,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,SAAS;MACvD,OAAO;QACL,MAAM,EAAE,SAAS;QACjBC,OAAO,EAAE;UAAEC,WAAW,EAAEF,IAAI,CAACE;QAAY;MAC3C,CAAC;IAEH,KAAM,OAAOF,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;MACtD,MAAMG,YAA8C,GAAG,IAAIC,KAAK,CAAC,CAAC;MAClE,KAAK,MAAMC,GAAG,IAAIL,IAAI,CAACM,gBAAgB,EAAE;QACvC,MAAMC,mBAAmB,GAAGP,IAAI,CAACM,gBAAgB,CAACD,GAAG,CAAC;QACtD,IAAIG,KAAgC;QACpC,IAAI,OAAOD,mBAAmB,KAAK,QAAQ,EAAE;UAC3CC,KAAK,GA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["distributeTypeHelper","propertyTypeTypeToOntologyIrType","type","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","field","apiName","displayMetadata","displayName","description","undefined","typeClasses","aliases","fieldType","push","struct","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","supportsFullTextRegex","precision","scale","geohash","mediaReference","geotimeSeriesReference","attachment","Error","JSON","stringify"],"sources":["propertyTypeTypeToOntologyIrType.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\nimport type {\n OntologyIrStructFieldType,\n OntologyIrType,\n} from \"@osdk/client.unstable\";\nimport type { PropertyTypeType } from \"../../api/properties/PropertyTypeType.js\";\nimport { distributeTypeHelper } from \"../toConjure/distributeTypeHelper.js\";\n\nexport function propertyTypeTypeToOntologyIrType(\n type: PropertyTypeType,\n): OntologyIrType {\n switch (true) {\n case (typeof type === \"object\" && type.type === \"marking\"):\n return {\n \"type\": \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case (typeof type === \"object\" && type.type === \"struct\"):\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: propertyTypeTypeToOntologyIrType(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: propertyTypeTypeToOntologyIrType(\n fieldTypeDefinition.fieldType,\n ),\n displayMetadata: fieldTypeDefinition.displayMetadata\n ?? { displayName: key, description: undefined },\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: propertyTypeTypeToOntologyIrType(fieldTypeDefinition),\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: { structFields },\n };\n\n case (typeof type === \"object\" && type.type === \"string\"):\n return {\n \"type\": \"string\",\n \"string\": {\n analyzerOverride: undefined,\n enableAsciiFolding: type.enableAsciiFolding,\n isLongText: type.isLongText ?? false,\n supportsEfficientLeadingWildcard:\n type.supportsEfficientLeadingWildcard ?? false,\n supportsExactMatching: type.supportsExactMatching ?? true,\n supportsFullTextRegex: type.supportsFullTextRegex,\n },\n };\n\n case (typeof type === \"object\" && type.type === \"decimal\"):\n return {\n \"type\": \"decimal\",\n \"decimal\": {\n precision: type.precision,\n scale: type.scale,\n },\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 case (type === \"geotimeSeries\"):\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {},\n };\n case (type === \"attachment\"):\n return {\n type: \"attachment\",\n attachment: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n if (typeof type === \"object\") {\n throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);\n }\n return distributeTypeHelper(type);\n }\n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AW,uBAAuB;AAmI/D,OAAO,iBAAS,oBACdC,KAAK,2BAA2B,mCAChCC,cACAC,MAAM;AAiBR,OAAO,iBAAS,iBACdF,KAAK,2BAA2B,mCAChCG,aACI,eAAe,oCACf,eAAe,wBACnBC,cAAc,aACdC,cAAc,0BACb,MAAM;AAkhBT,OAAO,iBAAS,MAAMC;AAYtB,OAAO,iBAAS,sBACdC,kBAAkB,iCAClBC,mBAAmB,oBAClB,MAAM;AAiJT,OAAO,iBAAS,yBACdR,KAAK,2BAA2B,mCAChCS,YAAY,eACZR;AA6BF,OAAO,iBAAS,+BACdD,KAAK,2BAA2B,mCAChCS,YAAY,eACZC,YAAY,mBACZC;AAaF,OAAO,iBAAS,0BACdC,6BACAR,cAAc,aACdS;AAgBF,OAAO,iBAAS,kBAAkBC;AAOlC,OAAO,iBAAS,+BACdC,KAAK;AAqBP,OAAO,iBAAS,0BACdA,KAAK,mCACLC;AAaF,OAAO,iBAAS,8BACdD,KAAK,mCACLC;AAMF,OAAO,iBAAS,sCACdC,YACAC,KAAK,uBACLC,WAAW,oCACV","names":["MODIFY_OBJECT_PARAMETER: string","CREATE_OR_MODIFY_OBJECT_PARAMETER: string","DELETE_OBJECT_PARAMETER: string","CREATE_INTERFACE_OBJECT_PARAMETER: string","MODIFY_INTERFACE_OBJECT_PARAMETER: string","actionDef: ActionTypeDefinition","def: ActionTypeUserDefinition | InterfaceActionTypeUserDefinition","name: string","type: PropertyTypeType","propertyMap:\n | Record<string, ObjectPropertyTypeUserDefinition>\n | Record<string, InterfacePropertyType>","parameterSet: Set<string>","requiredMap?: Record<string, boolean>","s: string","actionValidation: ActionLevelValidationDefinition","actionParameters?: ActionParameter[]","properties: Array<string>","parameters: ActionParameter[]","priorityId?: string","parameterOrdering: string[]","actionApiName: string","parameterId: string","def: InterfaceActionTypeUserDefinition","parameter: string","id: string","def: InterfacePropertyType","actionDef: InterfaceActionTypeUserDefinition"],"sources":["../../../src/api/defineAction.ts"],"version":3,"file":"defineAction.d.ts"}
|
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
import type { DerivedPropertyLinkTypeSide, ObjectTypeFieldApiName } from "@osdk/client.unstable";
|
|
1
|
+
import type { DerivedPropertyLinkTypeSide, MarkingType, ObjectTypeFieldApiName } from "@osdk/client.unstable";
|
|
2
2
|
import type { LinkType } from "../links/LinkType.js";
|
|
3
|
+
import type { SecurityConditionDefinition } from "./SecurityCondition.js";
|
|
3
4
|
export type ObjectTypeDatasourceDefinition = ObjectTypeDatasourceDefinition_stream | ObjectTypeDatasourceDefinition_dataset | ObjectTypeDatasourceDefinition_restrictedView | ObjectTypeDatasourceDefinition_derived;
|
|
4
5
|
export interface ObjectTypeDatasourceDefinition_dataset {
|
|
5
6
|
type: "dataset";
|
|
7
|
+
objectSecurityPolicy?: ObjectSecurityPolicy;
|
|
8
|
+
propertySecurityGroups?: Array<PropertySecurityGroup>;
|
|
9
|
+
}
|
|
10
|
+
export interface ObjectSecurityPolicy {
|
|
11
|
+
name: string;
|
|
12
|
+
granularPolicy?: SecurityConditionDefinition;
|
|
13
|
+
additionalMandatoryMarkings?: Record<string, MarkingType>;
|
|
14
|
+
}
|
|
15
|
+
export interface PropertySecurityGroup {
|
|
16
|
+
name: string;
|
|
17
|
+
properties: Array<string>;
|
|
18
|
+
granularPolicy?: SecurityConditionDefinition;
|
|
19
|
+
additionalMandatoryMarkings?: Record<string, MarkingType>;
|
|
6
20
|
}
|
|
7
21
|
export interface ObjectTypeDatasourceDefinition_stream {
|
|
8
22
|
type: "stream";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,6BACA,8BACK,uBAAwB;AAC/B,cAAc,gBAAgB,sBAAuB;
|
|
1
|
+
{"mappings":"AAgBA,cACE,6BACA,aACA,8BACK,uBAAwB;AAC/B,cAAc,gBAAgB,sBAAuB;AACrD,cAAc,mCAAmC,wBAAyB;AAE1E,YAAY,iCACR,wCACA,yCACA,gDACA;AAEJ,iBAAiB,uCAAuC;CACtD,MAAM;CACN,uBAAuB;CACvB,yBAAyB,MAAM;AAChC;AAED,iBAAiB,qBAAqB;CACpC;CACA,iBAAiB;CACjB,8BAA8B,eAAe;AAC9C;AAED,iBAAiB,sBAAsB;CACrC;CACA,YAAY;CACZ,iBAAiB;CACjB,8BAA8B,eAAe;AAC9C;AAED,iBAAiB,sCAAsC;CACrD,MAAM;CAEN;AACD;AAED,iBAAiB,8CAA8C;CAC7D,MAAM;AACP;AAED,iBAAiB,uCAAuC;CACtD,MAAM;CACN,gBAAgB,MAAM;CAEtB,iBACI,OAAO,wBAAwB,0BAC/B,OAAO,wBAAwB;AACpC;AACD,iBAAiB,gCAAgC;CAC/C,UAAU;CACV,OAAO;AACR;AAGD,YAAY,6BACR;CAAE,MAAM;AAAS,IACjB;CAAE,MAAM;CAAO,UAAU;AAAwB,IACjD;CAAE,MAAM;CAAO,UAAU;AAAwB,IACjD;CAAE,MAAM;CAAO,UAAU;AAAwB,IACjD;CAAE,MAAM;CAAO,UAAU;AAAwB,IACjD;CAAE,MAAM;CAA0B,UAAU;AAAwB,IACpE;CAAE,MAAM;CAAoB,UAAU;AAAwB,IAC9D;CAAE,MAAM;CAAe,UAAU;CAAwB;AAAe,IACxE;CAAE,MAAM;CAAc,UAAU;CAAwB;AAAe","names":[],"sources":["../../../../src/api/object/ObjectTypeDatasourceDefinition.ts"],"version":3,"file":"ObjectTypeDatasourceDefinition.d.ts"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { OntologyIrSecurityGroupGranularCondition } from "@osdk/client.unstable";
|
|
2
|
+
export type SecurityConditionDefinition = SecurityUnionCondition | OntologyIrSecurityGroupGranularCondition | SecurityGroupValidationRule | SecurityGroupPropertyValidationRule | SecurityMarkingPropertyRule;
|
|
3
|
+
export type SecurityUnionCondition = {
|
|
4
|
+
type: "and" | "or"
|
|
5
|
+
conditions: Array<SecurityConditionDefinition>
|
|
6
|
+
};
|
|
7
|
+
export type SecurityGroupValidationRule = {
|
|
8
|
+
type: "group"
|
|
9
|
+
name: string
|
|
10
|
+
};
|
|
11
|
+
export type SecurityGroupPropertyValidationRule = {
|
|
12
|
+
type: "groupProperty"
|
|
13
|
+
property: string
|
|
14
|
+
};
|
|
15
|
+
export type SecurityMarkingPropertyRule = {
|
|
16
|
+
type: "markingProperty"
|
|
17
|
+
property: string
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,gDACK,uBAAwB;AAE/B,YAAY,8BACR,yBACA,2CACA,8BACA,sCACA;AAEJ,YAAY,yBAAyB;CACnC,MAAM,QAAQ;CACd,YAAY,MAAM;AACnB;AAGD,YAAY,8BAA8B;CACxC,MAAM;CACN;AACD;AAGD,YAAY,sCAAsC;CAChD,MAAM;CACN;AACD;AAED,YAAY,8BAA8B;CACxC,MAAM;CACN;AACD","names":[],"sources":["../../../../src/api/object/SecurityCondition.ts"],"version":3,"file":"SecurityCondition.d.ts"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StructFieldType } from "@osdk/client.unstable";
|
|
2
2
|
export type PropertyTypeType = PropertyTypeTypePrimitive | PropertyTypeTypeExotic;
|
|
3
|
-
export type PropertyTypeTypePrimitive = "boolean" | "byte" | "date" | "decimal" | "double" | "float" | "integer" | "long" | "short" | "string" | "timestamp";
|
|
3
|
+
export type PropertyTypeTypePrimitive = "boolean" | "byte" | "date" | "decimal" | "double" | "float" | "integer" | "long" | "short" | "string" | "timestamp" | "attachment";
|
|
4
4
|
export type PropertyTypeTypeExotic = "geopoint" | "geoshape" | "mediaReference" | "geotimeSeries" | PropertyTypeTypeMarking | PropertyTypeTypeStruct | PropertyTypeTypeString | PropertyTypeTypeDecimal;
|
|
5
5
|
type PropertyTypeTypeMarking = {
|
|
6
6
|
type: "marking"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,uBAAuB,uBAAwB;AAE7D,YAAY,mBACR,4BACA;AAEJ,YAAY,4BACR,YACA,SACA,SACA,YACA,WACA,UACA,YACA,SACA,UACA,WACA;AAEJ,YAAY,yBACR,aACA,aACA,mBACA,kBACA,0BACA,yBACA,yBACA;KAEC,0BAA0B;CAC7B,MAAM;CACN,aAAa,cAAc;CAC3B;AACD;AAED,YAAY,yBAAyB;CACnC,MAAM;CACN,kBAAkB;sBAEZ,qBACA,QAAQ,gCAAgC;CAC7C;AACF;KAEI,yBAAyB;CAC5B,MAAM;CACN;CACA;CACA;CACA;CACA;AACD;KAEI,0BAA0B;CAC7B,MAAM;CACN;CACA;AACD;AAED,YAAY,iCAAiC,QAC3C,kBACA;AAEF,OAAO,iBAAS,mBACdA,GAAG,mBACF,KAAK;AASR,OAAO,iBAAS,SACdC,MAAM,+BACL,QAAQ;AAeX,OAAO,iBAAS,SACdC,MAAM,mBACL,QAAQ;KAIN;CAAS;CAAG,gBAAgB;IAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,GAAG;AAEpE,iBAAiB,2BACf,SACE,KACE,iBACA,cAAc,mBAAmB,YAEnC,gBAAgB,WAEpB;CACE,WAAW;CACX;AACD","names":["v: PropertyTypeType","type: PropertyTypeType | undefined","type: PropertyTypeType"],"sources":["../../../../src/api/properties/PropertyTypeType.ts"],"version":3,"file":"PropertyTypeType.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,cAAc,uBAAuB,uBAAwB;AAE7D,YAAY,mBACR,4BACA;AAEJ,YAAY,4BACR,YACA,SACA,SACA,YACA,WACA,UACA,YACA,SACA,UACA,WACA,cACA;AAEJ,YAAY,yBACR,aACA,aACA,mBACA,kBACA,0BACA,yBACA,yBACA;KAEC,0BAA0B;CAC7B,MAAM;CACN,aAAa,cAAc;CAC3B;AACD;AAED,YAAY,yBAAyB;CACnC,MAAM;CACN,kBAAkB;sBAEZ,qBACA,QAAQ,gCAAgC;CAC7C;AACF;KAEI,yBAAyB;CAC5B,MAAM;CACN;CACA;CACA;CACA;CACA;AACD;KAEI,0BAA0B;CAC7B,MAAM;CACN;CACA;AACD;AAED,YAAY,iCAAiC,QAC3C,kBACA;AAEF,OAAO,iBAAS,mBACdA,GAAG,mBACF,KAAK;AASR,OAAO,iBAAS,SACdC,MAAM,+BACL,QAAQ;AAeX,OAAO,iBAAS,SACdC,MAAM,mBACL,QAAQ;KAIN;CAAS;CAAG,gBAAgB;IAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,GAAG;AAEpE,iBAAiB,2BACf,SACE,KACE,iBACA,cAAc,mBAAmB,YAEnC,gBAAgB,WAEpB;CACE,WAAW;CACX;AACD","names":["v: PropertyTypeType","type: PropertyTypeType | undefined","type: PropertyTypeType"],"sources":["../../../../src/api/properties/PropertyTypeType.ts"],"version":3,"file":"PropertyTypeType.d.ts"}
|
|
@@ -4,3 +4,4 @@ export declare const defaultTypeClasses: TypeClass[];
|
|
|
4
4
|
export declare function shouldNotHaveRenderHints(type: PropertyTypeType): boolean;
|
|
5
5
|
export declare function hasRenderHints(typeClasses: TypeClass[] | undefined): boolean;
|
|
6
6
|
export declare function getPropertyTypeName(type: PropertyTypeType): string;
|
|
7
|
+
export declare function shouldBeIndexedForSearch(type: PropertyTypeType): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,iBAAiB,uBAAwB;AACvD,cAAc,wBAAwB,kCAAmC;AAEzE,OAAO,cAAMA,oBAAoB;AAMjC,OAAO,iBAAS,yBAAyBC,MAAM;AAM/C,OAAO,iBAAS,eAAeC,aAAa;AAM5C,OAAO,iBAAS,oBAAoBD,MAAM","names":["defaultTypeClasses: TypeClass[]","type: PropertyTypeType","typeClasses: TypeClass[] | undefined"],"sources":["../../../src/api/propertyConversionUtils.ts"],"version":3,"file":"propertyConversionUtils.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,cAAc,iBAAiB,uBAAwB;AACvD,cAAc,wBAAwB,kCAAmC;AAEzE,OAAO,cAAMA,oBAAoB;AAMjC,OAAO,iBAAS,yBAAyBC,MAAM;AAM/C,OAAO,iBAAS,eAAeC,aAAa;AAM5C,OAAO,iBAAS,oBAAoBD,MAAM;AAI1C,OAAO,iBAAS,yBACdA,MAAM","names":["defaultTypeClasses: TypeClass[]","type: PropertyTypeType","typeClasses: TypeClass[] | undefined"],"sources":["../../../src/api/propertyConversionUtils.ts"],"version":3,"file":"propertyConversionUtils.d.ts"}
|