@osdk/maker 0.16.0-beta.4 → 0.16.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @osdk/maker
2
2
 
3
+ ## 0.16.0-beta.5
4
+
5
+ ### Minor Changes
6
+
7
+ - 034081a: oac direct datasources
8
+
9
+ ### Patch Changes
10
+
11
+ - @osdk/api@2.8.0-beta.7
12
+
3
13
  ## 0.16.0-beta.4
4
14
 
5
15
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectTypeDatasourceDefinition.js","names":[],"sources":["ObjectTypeDatasourceDefinition.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 DerivedPropertyLinkTypeSide,\n MarkingType,\n ObjectTypeFieldApiName,\n} from \"@osdk/client.unstable\";\nimport type { LinkType } from \"../links/LinkType.js\";\nimport type { SecurityConditionDefinition } from \"./SecurityCondition.js\";\n\nexport type ObjectTypeDatasourceDefinition =\n | ObjectTypeDatasourceDefinition_stream\n | ObjectTypeDatasourceDefinition_dataset\n | ObjectTypeDatasourceDefinition_restrictedView\n | ObjectTypeDatasourceDefinition_derived;\n\nexport interface ObjectTypeDatasourceDefinition_dataset {\n type: \"dataset\";\n objectSecurityPolicy?: ObjectSecurityPolicy;\n propertySecurityGroups?: Array<PropertySecurityGroup>;\n}\n\nexport interface ObjectSecurityPolicy {\n name: string;\n granularPolicy?: SecurityConditionDefinition;\n additionalMandatoryMarkings?: Record<string, MarkingType>;\n}\n\nexport interface PropertySecurityGroup {\n name: string;\n properties: Array<string>;\n granularPolicy?: SecurityConditionDefinition;\n additionalMandatoryMarkings?: Record<string, MarkingType>;\n}\n\nexport interface ObjectTypeDatasourceDefinition_stream {\n type: \"stream\";\n // Retention period must be in ISO 8601 duration format\n retentionPeriod?: string;\n}\n\nexport interface ObjectTypeDatasourceDefinition_restrictedView {\n type: \"restrictedView\";\n}\n\nexport interface ObjectTypeDatasourceDefinition_derived {\n type: \"derived\";\n linkDefinition: Array<DerivedPropertiesLinkDefinition>;\n // property->property is linkedProperties, property->aggregation is aggregatedProperties\n propertyMapping:\n | Record<ObjectTypeFieldApiName, ObjectTypeFieldApiName>\n | Record<ObjectTypeFieldApiName, DerivedPropertyAggregation>;\n}\nexport interface DerivedPropertiesLinkDefinition {\n linkType: LinkType;\n side?: DerivedPropertyLinkTypeSide;\n}\n\n// if the property is null on the object, it is ignored in aggregations\nexport type DerivedPropertyAggregation =\n | { type: \"count\" } // total count of objects\n | { type: \"avg\"; property: ObjectTypeFieldApiName }\n | { type: \"sum\"; property: ObjectTypeFieldApiName }\n | { type: \"min\"; property: ObjectTypeFieldApiName }\n | { type: \"max\"; property: ObjectTypeFieldApiName }\n | { type: \"approximateCardinality\"; property: ObjectTypeFieldApiName }\n | { type: \"exactCardinality\"; property: ObjectTypeFieldApiName }\n | { type: \"collectList\"; property: ObjectTypeFieldApiName; limit: number } // max limit is 100\n | { type: \"collectSet\"; property: ObjectTypeFieldApiName; limit: number }; // max limit is 100\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ObjectTypeDatasourceDefinition.js","names":[],"sources":["ObjectTypeDatasourceDefinition.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 DerivedPropertyLinkTypeSide,\n MarkingType,\n ObjectTypeFieldApiName,\n} from \"@osdk/client.unstable\";\nimport type { LinkType } from \"../links/LinkType.js\";\nimport type { SecurityConditionDefinition } from \"./SecurityCondition.js\";\n\nexport type ObjectTypeDatasourceDefinition =\n | ObjectTypeDatasourceDefinition_stream\n | ObjectTypeDatasourceDefinition_dataset\n | ObjectTypeDatasourceDefinition_restrictedView\n | ObjectTypeDatasourceDefinition_derived\n | ObjectTypeDatasourceDefinition_direct;\n\nexport interface ObjectTypeDatasourceDefinition_dataset {\n type: \"dataset\";\n objectSecurityPolicy?: ObjectSecurityPolicy;\n propertySecurityGroups?: Array<PropertySecurityGroup>;\n}\n\nexport interface ObjectSecurityPolicy {\n name: string;\n granularPolicy?: SecurityConditionDefinition;\n additionalMandatoryMarkings?: Record<string, MarkingType>;\n}\n\nexport interface PropertySecurityGroup {\n name: string;\n properties: Array<string>;\n granularPolicy?: SecurityConditionDefinition;\n additionalMandatoryMarkings?: Record<string, MarkingType>;\n}\n\nexport interface ObjectTypeDatasourceDefinition_stream {\n type: \"stream\";\n // Retention period must be in ISO 8601 duration format\n retentionPeriod?: string;\n}\n\nexport interface ObjectTypeDatasourceDefinition_restrictedView {\n type: \"restrictedView\";\n}\n\nexport interface ObjectTypeDatasourceDefinition_derived {\n type: \"derived\";\n linkDefinition: Array<DerivedPropertiesLinkDefinition>;\n // property->property is linkedProperties, property->aggregation is aggregatedProperties\n propertyMapping:\n | Record<ObjectTypeFieldApiName, ObjectTypeFieldApiName>\n | Record<ObjectTypeFieldApiName, DerivedPropertyAggregation>;\n}\nexport interface DerivedPropertiesLinkDefinition {\n linkType: LinkType;\n side?: DerivedPropertyLinkTypeSide;\n}\n\n// if the property is null on the object, it is ignored in aggregations\nexport type DerivedPropertyAggregation =\n | { type: \"count\" } // total count of objects\n | { type: \"avg\"; property: ObjectTypeFieldApiName }\n | { type: \"sum\"; property: ObjectTypeFieldApiName }\n | { type: \"min\"; property: ObjectTypeFieldApiName }\n | { type: \"max\"; property: ObjectTypeFieldApiName }\n | { type: \"approximateCardinality\"; property: ObjectTypeFieldApiName }\n | { type: \"exactCardinality\"; property: ObjectTypeFieldApiName }\n | { type: \"collectList\"; property: ObjectTypeFieldApiName; limit: number } // max limit is 100\n | { type: \"collectSet\"; property: ObjectTypeFieldApiName; limit: number }; // max limit is 100\n\nexport interface ObjectTypeDatasourceDefinition_direct {\n type: \"direct\";\n objectSecurityPolicy?: ObjectSecurityPolicy;\n propertySecurityGroups?: Array<PropertySecurityGroup>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -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.16.0-beta.4" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
27
+ const commandLineOpts = await yargs(hideBin(args)).version("0.16.0-beta.5" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
28
28
  input: {
29
29
  alias: "i",
30
30
  describe: "Input file",
@@ -16,7 +16,7 @@
16
16
 
17
17
  import invariant from "tiny-invariant";
18
18
  export function convertDatasourceDefinition(objectType, properties) {
19
- const baseDatasource = objectType.datasources?.find(ds => ["dataset", "stream", "restrictedView"].includes(ds.type));
19
+ const baseDatasource = objectType.datasources?.find(ds => ["dataset", "stream", "restrictedView", "direct"].includes(ds.type));
20
20
  switch (baseDatasource?.type) {
21
21
  case "stream":
22
22
  const window = baseDatasource.retentionPeriod;
@@ -55,6 +55,15 @@ export function convertDatasourceDefinition(objectType, properties) {
55
55
  propertyMapping: buildPropertyMapping(properties)
56
56
  }
57
57
  };
58
+ case "direct":
59
+ return {
60
+ type: "direct",
61
+ direct: {
62
+ directSourceRid: objectType.apiName,
63
+ propertyMapping: buildPropertyMapping(properties),
64
+ propertySecurityGroups: convertPropertySecurityGroups(baseDatasource, properties, objectType.primaryKeyPropertyApiName)
65
+ }
66
+ };
58
67
  case "dataset":
59
68
  default:
60
69
  if (objectType.properties?.some(prop => typeof prop.type === "object" && prop.type.type === "marking") || baseDatasource?.objectSecurityPolicy || baseDatasource?.propertySecurityGroups) {
@@ -1 +1 @@
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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CAACC,OAAO,EAAE;QAAEX,IAAI,EAAE,UAAU;QAAEqE,QAAQ,EAAE,CAAC;MAAE,CAAC,CAAC;IAC3D;IACA;IACA,IAAI,OAAO3D,IAAI,CAACV,IAAI,KAAK,QAAQ,IAAIU,IAAI,CAACV,IAAI,EAAEA,IAAI,KAAK,QAAQ,EAAE;MACjE,MAAMsE,aAAa,GAAG;QACpBtE,IAAI,EAAE,QAAQ;QACduE,MAAM,EAAE;UACNC,MAAM,EAAE9D,IAAI,CAACC,OAAO;UACpB8D,OAAO,EAAElE,MAAM,CAACC,WAAW,CACzBD,MAAM,CAACmE,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
+ {"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","direct","directSourceRid","convertPropertySecurityGroups","primaryKeyPropertyApiName","some","objectSecurityPolicy","datasetV3","branchId","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 {\n ObjectTypeDatasourceDefinition_dataset,\n ObjectTypeDatasourceDefinition_direct,\n} 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\", \"direct\"].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 \"direct\":\n return {\n type: \"direct\",\n direct: {\n directSourceRid: objectType.apiName,\n propertyMapping: buildPropertyMapping(properties),\n propertySecurityGroups: convertPropertySecurityGroups(\n baseDatasource,\n properties,\n objectType.primaryKeyPropertyApiName,\n ),\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:\n | ObjectTypeDatasourceDefinition_dataset\n | ObjectTypeDatasourceDefinition_direct\n | 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;AAStC,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,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAACD,EAAE,CAACE,IAAI,CACpE,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,iBAAiB,EAAExB,UAAU,CAACkB,OAAO;UACrCL,eAAe,EAAEY,oBAAoB,CAACxB,UAAU;QAClD;MACF,CAAC;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UACpBgE,OAAO,EAAEpE,MAAM,CAACC,WAAW,CACzBD,MAAM,CAACqE,IAAI,CAAClE,IAAI,CAACV,IAAI,CAAC6E,gBAAgB,CAAC,CAACpE,GAAG,CAAEqE,SAAS,IAAK,CACzDA,SAAS,EACT;YAAEnE,OAAO,EAAEmE,SAAS;YAAEC,QAAQ,EAAE,CAAC;UAAE,CAAC,CACrC,CACH;QACF;MACF,CAAC;MACD,OAAO,CAACrE,IAAI,CAACC,OAAO,EAAE6D,aAAa,CAAC;IACtC;IACA;IACA,OAAO,CAAC9D,IAAI,CAACC,OAAO,EAAE;MAAEX,IAAI,EAAE,QAAQ;MAAE0E,MAAM,EAAEhE,IAAI,CAACC;IAAQ,CAAC,CAAC;EACjE,CAAC,CACH,CAAC;AACH","ignoreList":[]}
@@ -1314,7 +1314,7 @@ function convertInterface(interfaceType) {
1314
1314
  };
1315
1315
  }
1316
1316
  function convertDatasourceDefinition(objectType, properties) {
1317
- const baseDatasource = objectType.datasources?.find((ds) => ["dataset", "stream", "restrictedView"].includes(ds.type));
1317
+ const baseDatasource = objectType.datasources?.find((ds) => ["dataset", "stream", "restrictedView", "direct"].includes(ds.type));
1318
1318
  switch (baseDatasource?.type) {
1319
1319
  case "stream":
1320
1320
  const window = baseDatasource.retentionPeriod;
@@ -1353,6 +1353,15 @@ function convertDatasourceDefinition(objectType, properties) {
1353
1353
  propertyMapping: buildPropertyMapping(properties)
1354
1354
  }
1355
1355
  };
1356
+ case "direct":
1357
+ return {
1358
+ type: "direct",
1359
+ direct: {
1360
+ directSourceRid: objectType.apiName,
1361
+ propertyMapping: buildPropertyMapping(properties),
1362
+ propertySecurityGroups: convertPropertySecurityGroups(baseDatasource, properties, objectType.primaryKeyPropertyApiName)
1363
+ }
1364
+ };
1356
1365
  case "dataset":
1357
1366
  default:
1358
1367
  if (objectType.properties?.some((prop) => typeof prop.type === "object" && prop.type.type === "marking") || baseDatasource?.objectSecurityPolicy || baseDatasource?.propertySecurityGroups) {
@@ -2613,7 +2622,7 @@ function addNamespaceIfNone(apiName) {
2613
2622
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
2614
2623
  var uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
2615
2624
  async function main(args = process.argv) {
2616
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.16.0-beta.4").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
2625
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.16.0-beta.5").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
2617
2626
  input: {
2618
2627
  alias: "i",
2619
2628
  describe: "Input file",