@osdk/maker 0.15.0-beta.7 → 0.15.0-beta.8
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 +11 -0
- package/README.md +26 -22
- package/build/browser/api/defineInterface.js.map +1 -1
- package/build/browser/api/defineOntology.js +6 -0
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/defineValueType.js +17 -4
- package/build/browser/api/defineValueType.js.map +1 -1
- package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +5 -0
- package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -1
- package/build/browser/api/links/LinkType.js.map +1 -1
- package/build/browser/api/object/ObjectTypeStatus.js.map +1 -1
- package/build/browser/api/test/interfaces.test.js +12 -0
- package/build/browser/api/test/interfaces.test.js.map +1 -1
- package/build/browser/api/test/valueTypes.test.js +69 -0
- package/build/browser/api/test/valueTypes.test.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/conversion/toMarketplace/convertLink.js +30 -4
- package/build/browser/conversion/toMarketplace/convertLink.js.map +1 -1
- package/build/cjs/index.cjs +59 -9
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +26 -5
- package/build/esm/api/defineInterface.js.map +1 -1
- package/build/esm/api/defineOntology.js +6 -0
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/defineValueType.js +17 -4
- package/build/esm/api/defineValueType.js.map +1 -1
- package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +5 -0
- package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -1
- package/build/esm/api/links/LinkType.js.map +1 -1
- package/build/esm/api/object/ObjectTypeStatus.js.map +1 -1
- package/build/esm/api/test/interfaces.test.js +12 -0
- package/build/esm/api/test/interfaces.test.js.map +1 -1
- package/build/esm/api/test/valueTypes.test.js +69 -0
- package/build/esm/api/test/valueTypes.test.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/conversion/toMarketplace/convertLink.js +30 -4
- package/build/esm/conversion/toMarketplace/convertLink.js.map +1 -1
- package/build/types/api/defineInterface.d.ts +2 -0
- package/build/types/api/defineInterface.d.ts.map +1 -1
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/defineValueType.d.ts +9 -0
- package/build/types/api/defineValueType.d.ts.map +1 -1
- package/build/types/api/links/LinkType.d.ts +16 -4
- package/build/types/api/links/LinkType.d.ts.map +1 -1
- package/build/types/api/object/ObjectTypeStatus.d.ts +1 -1
- package/build/types/api/object/ObjectTypeStatus.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertLink.d.ts +3 -2
- package/build/types/conversion/toMarketplace/convertLink.d.ts.map +1 -1
- package/package.json +4 -4
package/build/cjs/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OntologyIrLabelledValue, OntologyIrConditionValue, OntologyIrParameterDateRangeValue, InterfaceTypeApiName, OntologyIrCondition, OntologyIrParameterPrefill, OntologyIrBaseParameterType_decimal, OntologyIrBaseParameterType_decimalList, OntologyIrBaseParameterType_timestamp, OntologyIrBaseParameterType_timestampList, OntologyIrBaseParameterType_objectReference, OntologyIrBaseParameterType_objectReferenceList, OntologyIrBaseParameterType_objectSetRid, OntologyIrBaseParameterType_objectTypeReference, OntologyIrBaseParameterType_interfaceReference, OntologyIrBaseParameterType_interfaceReferenceList, OntologyIrBaseParameterType_struct, OntologyIrBaseParameterType_structList, ParameterRenderHint, ParameterId, ActionTypeStatus_deprecated, ButtonDisplayMetadata, ActionTypeApiName, OntologyIrLogicRule, SectionId, OntologyIrActionTypeEntities, OntologyIrFormContent, OntologyIrValidationRule, DisplayMetadataConfigurationDefaultLayout, DisplayMetadataConfigurationDisplayAndFormat, OntologyIrLogicRuleValue_parameterId, OntologyIrLogicRuleValue_staticValue, OntologyIrLogicRuleValue_objectParameterPropertyValue, OntologyIrLogicRuleValue_interfaceParameterPropertyValue, OntologyIrLogicRuleValue_synchronousWebhookOutput, ValidationRuleDisplayMetadata, ParameterRid, StructFieldType, OntologyIrValueTypeReferenceWithMetadata, Visibility, SharedPropertyTypeGothamMapping, OntologyIrBaseFormatter, OntologyIrMarketplaceInterfaceType, InterfaceTypeStatus, ValueTypeApiName, ValueTypeDisplayMetadata, ValueTypeStatus, ValueTypeVersion, BaseType, ValueTypeDataConstraint, ExampleValue, LinkTypeMetadata,
|
|
1
|
+
import { OntologyIrLabelledValue, OntologyIrConditionValue, OntologyIrParameterDateRangeValue, InterfaceTypeApiName, OntologyIrCondition, OntologyIrParameterPrefill, OntologyIrBaseParameterType_decimal, OntologyIrBaseParameterType_decimalList, OntologyIrBaseParameterType_timestamp, OntologyIrBaseParameterType_timestampList, OntologyIrBaseParameterType_objectReference, OntologyIrBaseParameterType_objectReferenceList, OntologyIrBaseParameterType_objectSetRid, OntologyIrBaseParameterType_objectTypeReference, OntologyIrBaseParameterType_interfaceReference, OntologyIrBaseParameterType_interfaceReferenceList, OntologyIrBaseParameterType_struct, OntologyIrBaseParameterType_structList, ParameterRenderHint, ParameterId, ActionTypeStatus_deprecated, ButtonDisplayMetadata, ActionTypeApiName, OntologyIrLogicRule, SectionId, OntologyIrActionTypeEntities, OntologyIrFormContent, OntologyIrValidationRule, DisplayMetadataConfigurationDefaultLayout, DisplayMetadataConfigurationDisplayAndFormat, OntologyIrLogicRuleValue_parameterId, OntologyIrLogicRuleValue_staticValue, OntologyIrLogicRuleValue_objectParameterPropertyValue, OntologyIrLogicRuleValue_interfaceParameterPropertyValue, OntologyIrLogicRuleValue_synchronousWebhookOutput, ValidationRuleDisplayMetadata, ParameterRid, StructFieldType, OntologyIrValueTypeReferenceWithMetadata, Visibility, SharedPropertyTypeGothamMapping, OntologyIrBaseFormatter, OntologyIrMarketplaceInterfaceType, InterfaceTypeStatus, ValueTypeApiName, ValueTypeDisplayMetadata, ValueTypeStatus, ValueTypeVersion, BaseType, ValueTypeDataConstraint, ExampleValue, LinkTypeMetadata, LinkTypeId, DerivedPropertyLinkTypeSide, ObjectTypeFieldApiName, OntologyIrObjectType, OntologyIr, DataConstraint, FailureMessage, ValueTypeRid, OntologyIrType } from '@osdk/client.unstable';
|
|
2
2
|
|
|
3
3
|
declare function main(args?: string[]): Promise<void>;
|
|
4
4
|
|
|
@@ -331,7 +331,7 @@ type ValueTypeDefinitionVersion = OntologyEntityBase & {
|
|
|
331
331
|
__type: OntologyEntityTypeEnum.VALUE_TYPE;
|
|
332
332
|
};
|
|
333
333
|
|
|
334
|
-
type ObjectTypeStatus = "active" | "experimental" | {
|
|
334
|
+
type ObjectTypeStatus = "active" | "experimental" | "example" | {
|
|
335
335
|
type: "deprecated";
|
|
336
336
|
message: string;
|
|
337
337
|
deadline: string;
|
|
@@ -390,7 +390,7 @@ interface OneToManyLinkTypeDefinition {
|
|
|
390
390
|
manyForeignKeyProperty: ObjectTypePropertyApiName;
|
|
391
391
|
cardinality: "OneToMany" | "OneToOne" | undefined;
|
|
392
392
|
editsEnabled?: boolean;
|
|
393
|
-
status?:
|
|
393
|
+
status?: UserLinkTypeStatus;
|
|
394
394
|
redacted?: boolean;
|
|
395
395
|
}
|
|
396
396
|
interface OneToManyObjectLinkReference {
|
|
@@ -402,6 +402,8 @@ interface OneToManyLinkTypeUserDefinition {
|
|
|
402
402
|
one: OneToManyObjectLinkReferenceUserDefinition;
|
|
403
403
|
toMany: OneToManyObjectLinkReferenceUserDefinition;
|
|
404
404
|
manyForeignKeyProperty: ObjectTypePropertyApiName;
|
|
405
|
+
editsEnabled?: boolean;
|
|
406
|
+
status?: UserLinkTypeStatus;
|
|
405
407
|
cardinality?: "OneToMany" | "OneToOne" | undefined;
|
|
406
408
|
}
|
|
407
409
|
interface OneToManyObjectLinkReferenceUserDefinition {
|
|
@@ -413,7 +415,7 @@ interface ManyToManyLinkTypeDefinition {
|
|
|
413
415
|
many: ManyToManyObjectLinkReference;
|
|
414
416
|
toMany: ManyToManyObjectLinkReference;
|
|
415
417
|
editsEnabled?: boolean;
|
|
416
|
-
status?:
|
|
418
|
+
status?: UserLinkTypeStatus;
|
|
417
419
|
redacted?: boolean;
|
|
418
420
|
}
|
|
419
421
|
interface ManyToManyObjectLinkReference {
|
|
@@ -424,6 +426,8 @@ interface ManyToManyLinkTypeUserDefinition {
|
|
|
424
426
|
apiName: string;
|
|
425
427
|
many: ManyToManyObjectLinkReferenceUserDefinition;
|
|
426
428
|
toMany: ManyToManyObjectLinkReferenceUserDefinition;
|
|
429
|
+
editsEnabled?: boolean;
|
|
430
|
+
status?: UserLinkTypeStatus;
|
|
427
431
|
}
|
|
428
432
|
interface ManyToManyObjectLinkReferenceUserDefinition {
|
|
429
433
|
object: ObjectTypeDefinition | string;
|
|
@@ -435,7 +439,7 @@ interface IntermediaryLinkTypeDefinition {
|
|
|
435
439
|
toMany: IntermediaryObjectLinkReference;
|
|
436
440
|
intermediaryObjectType: ObjectTypeDefinition;
|
|
437
441
|
editsEnabled?: boolean;
|
|
438
|
-
status?:
|
|
442
|
+
status?: UserLinkTypeStatus;
|
|
439
443
|
redacted?: boolean;
|
|
440
444
|
}
|
|
441
445
|
interface IntermediaryObjectLinkReference {
|
|
@@ -448,6 +452,8 @@ interface IntermediaryLinkTypeUserDefinition {
|
|
|
448
452
|
many: IntermediaryObjectLinkReferenceUserDefinition;
|
|
449
453
|
toMany: IntermediaryObjectLinkReferenceUserDefinition;
|
|
450
454
|
intermediaryObjectType: ObjectTypeDefinition | string;
|
|
455
|
+
editsEnabled?: boolean;
|
|
456
|
+
status?: UserLinkTypeStatus;
|
|
451
457
|
}
|
|
452
458
|
interface IntermediaryObjectLinkReferenceUserDefinition {
|
|
453
459
|
object: ObjectTypeDefinition | string;
|
|
@@ -461,6 +467,12 @@ interface LinkTypeMetadataUserDefinition {
|
|
|
461
467
|
visibility?: Visibility;
|
|
462
468
|
groupDisplayName?: string;
|
|
463
469
|
}
|
|
470
|
+
type UserLinkTypeStatus = "active" | "experimental" | "example" | {
|
|
471
|
+
type: "deprecated";
|
|
472
|
+
message: string;
|
|
473
|
+
deadline: string;
|
|
474
|
+
replacedBy?: LinkTypeId;
|
|
475
|
+
};
|
|
464
476
|
|
|
465
477
|
type ObjectTypeDatasourceDefinition = ObjectTypeDatasourceDefinition_stream | ObjectTypeDatasourceDefinition_dataset | ObjectTypeDatasourceDefinition_restrictedView | ObjectTypeDatasourceDefinition_derived;
|
|
466
478
|
interface ObjectTypeDatasourceDefinition_dataset {
|
|
@@ -604,6 +616,8 @@ type SimplifiedInterfaceTypeStatus = {
|
|
|
604
616
|
type: "active";
|
|
605
617
|
} | {
|
|
606
618
|
type: "experimental";
|
|
619
|
+
} | {
|
|
620
|
+
type: "example";
|
|
607
621
|
};
|
|
608
622
|
type PropertyBase = SharedPropertyType | InterfaceDefinedProperty;
|
|
609
623
|
type SptWithOptional = {
|
|
@@ -889,6 +903,13 @@ type ValueTypeDefinition = {
|
|
|
889
903
|
description?: string;
|
|
890
904
|
type: NewValueTypeDefinition;
|
|
891
905
|
version: string;
|
|
906
|
+
status?: UserValueTypeStatus;
|
|
907
|
+
};
|
|
908
|
+
type UserValueTypeStatus = "active" | {
|
|
909
|
+
type: "deprecated";
|
|
910
|
+
message: string;
|
|
911
|
+
deadline: string;
|
|
912
|
+
replacedBy?: ValueTypeRid;
|
|
892
913
|
};
|
|
893
914
|
declare function defineValueType(valueTypeDef: ValueTypeDefinition): ValueTypeDefinitionVersion;
|
|
894
915
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineInterface.js","names":["invariant","OntologyEntityTypeEnum","namespace","ontologyDefinition","updateOntology","withoutNamespace","isInterfaceSharedPropertyType","mapSimplifiedStatusToInterfaceTypeStatus","combineApiNamespaceIfMissing","isExotic","isPropertyTypeType","defineInterface","interfaceDef","apiName","INTERFACE_TYPE","undefined","process","env","NODE_ENV","spts","Object","fromEntries","entries","properties","filter","_name","prop","map","s","spt","required","sharedPropertyType","propertiesV2","propName","type","sptApiName","verifyBasePropertyDefinition","propertiesV3","propertyBase","extendsInterfaces","extends","Array","isArray","status","deprecated","message","deadline","fullInterface","displayMetadata","displayName","description","icon","blueprint","color","locator","links","searchable","__type","unNamespacedTypeApiName","JSON","stringify","key"],"sources":["defineInterface.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceTypeStatus } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type { BlueprintIcon } from \"./common/BlueprintIcons.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n namespace,\n ontologyDefinition,\n updateOntology,\n withoutNamespace,\n} from \"./defineOntology.js\";\nimport {\n type InterfaceDefinedProperty,\n type InterfacePropertyType,\n isInterfaceSharedPropertyType,\n} from \"./interface/InterfacePropertyType.js\";\nimport { type InterfaceType } from \"./interface/InterfaceType.js\";\nimport { mapSimplifiedStatusToInterfaceTypeStatus } from \"./interface/mapSimplifiedStatusToInterfaceTypeStatus.js\";\nimport { combineApiNamespaceIfMissing } from \"./namespace/combineApiNamespaceIfMissing.js\";\nimport { isExotic, isPropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport { type SharedPropertyType } from \"./properties/SharedPropertyType.js\";\n\nexport type SimplifiedInterfaceTypeStatus =\n | { type: \"deprecated\"; message: string; deadline: string }\n | { type: \"active\" }\n | { type: \"experimental\" };\n\ntype PropertyBase =\n | SharedPropertyType\n | InterfaceDefinedProperty;\ntype SptWithOptional = {\n required: boolean;\n sharedPropertyType: SharedPropertyType;\n};\n\nexport type InterfaceTypeDefinition = {\n apiName: string;\n displayName?: string;\n description?: string;\n icon?: { locator: BlueprintIcon; color: string };\n status?: SimplifiedInterfaceTypeStatus;\n properties?: Record<\n string,\n PropertyBase | SptWithOptional\n >;\n extends?: InterfaceType | InterfaceType[];\n searchable?: boolean;\n};\n\nexport function defineInterface(\n interfaceDef: InterfaceTypeDefinition,\n): InterfaceType {\n const apiName = namespace + interfaceDef.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName]\n === undefined,\n `Interface ${apiName} already exists`,\n );\n\n // legacy support for propertiesV2 (only SPTs)\n const spts: Record<string, SptWithOptional> = Object.fromEntries(\n Object.entries(interfaceDef.properties ?? {}).filter(([_name, prop]) => {\n return isInterfaceSharedPropertyType(prop) || \"apiName\" in prop;\n }).map(([s, spt]) => {\n const required = isInterfaceSharedPropertyType(spt) ? spt.required : true;\n return [s, {\n sharedPropertyType: (isInterfaceSharedPropertyType(spt)\n ? spt.sharedPropertyType\n : spt) as SharedPropertyType,\n required: required,\n }];\n }),\n );\n const propertiesV2 = Object.fromEntries(\n Object.entries(spts).map<\n [string, { required: boolean; sharedPropertyType: SharedPropertyType }]\n >(\n ([propName, type]) => {\n const sptApiName = combineApiNamespaceIfMissing(\n namespace,\n type.sharedPropertyType.apiName,\n );\n return [sptApiName, {\n required: type.required,\n sharedPropertyType: verifyBasePropertyDefinition(\n namespace,\n propName,\n type.sharedPropertyType,\n ),\n }];\n },\n ),\n );\n\n const propertiesV3 = Object.fromEntries(\n Object.entries(interfaceDef.properties ?? {}).map<\n [string, InterfacePropertyType]\n >(([apiName, prop]) => {\n const required =\n (typeof prop === \"object\" && isInterfaceSharedPropertyType(prop))\n ? prop.required\n : true;\n const propertyBase: PropertyBase =\n (typeof prop === \"object\" && isInterfaceSharedPropertyType(prop))\n ? prop.sharedPropertyType\n : prop;\n if (\n typeof propertyBase === \"object\"\n && \"nonNameSpacedApiName\" in propertyBase\n ) {\n // SPT\n return [apiName, {\n required: required,\n sharedPropertyType: propertyBase,\n }];\n } else {\n // IDP\n return [apiName, propertyBase];\n }\n }),\n );\n\n const extendsInterfaces = interfaceDef.extends\n ? (Array.isArray(interfaceDef.extends)\n ? interfaceDef.extends\n : [interfaceDef.extends])\n : [];\n\n const status: InterfaceTypeStatus = mapSimplifiedStatusToInterfaceTypeStatus(\n interfaceDef.status ?? { type: \"active\" },\n );\n\n invariant(\n status.type !== \"deprecated\"\n || (status.deprecated.message && status.deprecated.deadline),\n `Deprecated status must include message and deadline properties.`,\n );\n\n const fullInterface: InterfaceType = {\n apiName,\n displayMetadata: {\n displayName: interfaceDef.displayName ?? interfaceDef.apiName,\n description: interfaceDef.description ?? interfaceDef.displayName\n ?? interfaceDef.apiName,\n icon: interfaceDef.icon !== undefined\n ? {\n type: \"blueprint\",\n blueprint: {\n color: interfaceDef.icon.color,\n locator: interfaceDef.icon.locator,\n },\n }\n : undefined,\n },\n extendsInterfaces,\n links: [],\n status,\n propertiesV2: propertiesV2,\n propertiesV3: propertiesV3,\n searchable: interfaceDef.searchable ?? true,\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE,\n };\n\n updateOntology(fullInterface);\n return fullInterface;\n}\n\nfunction verifyBasePropertyDefinition(\n namespace: string,\n apiName: string,\n type: SharedPropertyType,\n): SharedPropertyType {\n const unNamespacedTypeApiName = withoutNamespace(type.apiName);\n invariant(\n isPropertyTypeType(type.type) || isExotic(type.type),\n `Invalid data type ${\n JSON.stringify(type)\n } for property ${apiName} on InterfaceType ${apiName}`,\n );\n invariant(\n namespace + apiName === type.apiName\n || apiName === unNamespacedTypeApiName,\n `property key and it's apiName must be identical. ${\n JSON.stringify({ key: apiName, apiName: type.apiName })\n }`,\n );\n return type;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AAEtC,SAASC,s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,OAAO,CAAC;EAC9D,EACEH,kBAAkB,CAACwB,IAAI,CAACA,IAAI,CAAC,IAAIzB,QAAQ,CAACyB,IAAI,CAACA,IAAI,CAAC,IAAAlB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADtDlB,SAAS,QAEP,qBACE2D,IAAI,CAACC,SAAS,CAAC1B,IAAI,CAAC,iBACLrB,OAAO,qBAAqBA,OAAO,EAAE,IAJxDb,SAAS;EAMT,EACEE,SAAS,GAAGW,OAAO,KAAKqB,IAAI,CAACrB,OAAO,IAC/BA,OAAO,KAAK6C,uBAAuB,IAAA1C,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAF1ClB,SAAS,QAGP,oDACE2D,IAAI,CAACC,SAAS,CAAC;IAAEC,GAAG,EAAEhD,OAAO;IAAEA,OAAO,EAAEqB,IAAI,CAACrB;EAAQ,CAAC,CAAC,EACvD,IALJb,SAAS;EAOT,OAAOkC,IAAI;AACb","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"defineInterface.js","names":["invariant","OntologyEntityTypeEnum","namespace","ontologyDefinition","updateOntology","withoutNamespace","isInterfaceSharedPropertyType","mapSimplifiedStatusToInterfaceTypeStatus","combineApiNamespaceIfMissing","isExotic","isPropertyTypeType","defineInterface","interfaceDef","apiName","INTERFACE_TYPE","undefined","process","env","NODE_ENV","spts","Object","fromEntries","entries","properties","filter","_name","prop","map","s","spt","required","sharedPropertyType","propertiesV2","propName","type","sptApiName","verifyBasePropertyDefinition","propertiesV3","propertyBase","extendsInterfaces","extends","Array","isArray","status","deprecated","message","deadline","fullInterface","displayMetadata","displayName","description","icon","blueprint","color","locator","links","searchable","__type","unNamespacedTypeApiName","JSON","stringify","key"],"sources":["defineInterface.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceTypeStatus } from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport type { BlueprintIcon } from \"./common/BlueprintIcons.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n namespace,\n ontologyDefinition,\n updateOntology,\n withoutNamespace,\n} from \"./defineOntology.js\";\nimport {\n type InterfaceDefinedProperty,\n type InterfacePropertyType,\n isInterfaceSharedPropertyType,\n} from \"./interface/InterfacePropertyType.js\";\nimport { type InterfaceType } from \"./interface/InterfaceType.js\";\nimport { mapSimplifiedStatusToInterfaceTypeStatus } from \"./interface/mapSimplifiedStatusToInterfaceTypeStatus.js\";\nimport { combineApiNamespaceIfMissing } from \"./namespace/combineApiNamespaceIfMissing.js\";\nimport { isExotic, isPropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport { type SharedPropertyType } from \"./properties/SharedPropertyType.js\";\n\nexport type SimplifiedInterfaceTypeStatus =\n | { type: \"deprecated\"; message: string; deadline: string }\n | { type: \"active\" }\n | { type: \"experimental\" }\n | { type: \"example\" };\n\ntype PropertyBase =\n | SharedPropertyType\n | InterfaceDefinedProperty;\ntype SptWithOptional = {\n required: boolean;\n sharedPropertyType: SharedPropertyType;\n};\n\nexport type InterfaceTypeDefinition = {\n apiName: string;\n displayName?: string;\n description?: string;\n icon?: { locator: BlueprintIcon; color: string };\n status?: SimplifiedInterfaceTypeStatus;\n properties?: Record<\n string,\n PropertyBase | SptWithOptional\n >;\n extends?: InterfaceType | InterfaceType[];\n searchable?: boolean;\n};\n\nexport function defineInterface(\n interfaceDef: InterfaceTypeDefinition,\n): InterfaceType {\n const apiName = namespace + interfaceDef.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName]\n === undefined,\n `Interface ${apiName} already exists`,\n );\n\n // legacy support for propertiesV2 (only SPTs)\n const spts: Record<string, SptWithOptional> = Object.fromEntries(\n Object.entries(interfaceDef.properties ?? {}).filter(([_name, prop]) => {\n return isInterfaceSharedPropertyType(prop) || \"apiName\" in prop;\n }).map(([s, spt]) => {\n const required = isInterfaceSharedPropertyType(spt) ? spt.required : true;\n return [s, {\n sharedPropertyType: (isInterfaceSharedPropertyType(spt)\n ? spt.sharedPropertyType\n : spt) as SharedPropertyType,\n required: required,\n }];\n }),\n );\n const propertiesV2 = Object.fromEntries(\n Object.entries(spts).map<\n [string, { required: boolean; sharedPropertyType: SharedPropertyType }]\n >(\n ([propName, type]) => {\n const sptApiName = combineApiNamespaceIfMissing(\n namespace,\n type.sharedPropertyType.apiName,\n );\n return [sptApiName, {\n required: type.required,\n sharedPropertyType: verifyBasePropertyDefinition(\n namespace,\n propName,\n type.sharedPropertyType,\n ),\n }];\n },\n ),\n );\n\n const propertiesV3 = Object.fromEntries(\n Object.entries(interfaceDef.properties ?? {}).map<\n [string, InterfacePropertyType]\n >(([apiName, prop]) => {\n const required =\n (typeof prop === \"object\" && isInterfaceSharedPropertyType(prop))\n ? prop.required\n : true;\n const propertyBase: PropertyBase =\n (typeof prop === \"object\" && isInterfaceSharedPropertyType(prop))\n ? prop.sharedPropertyType\n : prop;\n if (\n typeof propertyBase === \"object\"\n && \"nonNameSpacedApiName\" in propertyBase\n ) {\n // SPT\n return [apiName, {\n required: required,\n sharedPropertyType: propertyBase,\n }];\n } else {\n // IDP\n return [apiName, propertyBase];\n }\n }),\n );\n\n const extendsInterfaces = interfaceDef.extends\n ? (Array.isArray(interfaceDef.extends)\n ? interfaceDef.extends\n : [interfaceDef.extends])\n : [];\n\n const status: InterfaceTypeStatus = mapSimplifiedStatusToInterfaceTypeStatus(\n interfaceDef.status ?? { type: \"active\" },\n );\n\n invariant(\n status.type !== \"deprecated\"\n || (status.deprecated.message && status.deprecated.deadline),\n `Deprecated status must include message and deadline properties.`,\n );\n\n const fullInterface: InterfaceType = {\n apiName,\n displayMetadata: {\n displayName: interfaceDef.displayName ?? interfaceDef.apiName,\n description: interfaceDef.description ?? interfaceDef.displayName\n ?? interfaceDef.apiName,\n icon: interfaceDef.icon !== undefined\n ? {\n type: \"blueprint\",\n blueprint: {\n color: interfaceDef.icon.color,\n locator: interfaceDef.icon.locator,\n },\n }\n : undefined,\n },\n extendsInterfaces,\n links: [],\n status,\n propertiesV2: propertiesV2,\n propertiesV3: propertiesV3,\n searchable: interfaceDef.searchable ?? true,\n __type: OntologyEntityTypeEnum.INTERFACE_TYPE,\n };\n\n updateOntology(fullInterface);\n return fullInterface;\n}\n\nfunction verifyBasePropertyDefinition(\n namespace: string,\n apiName: string,\n type: SharedPropertyType,\n): SharedPropertyType {\n const unNamespacedTypeApiName = withoutNamespace(type.apiName);\n invariant(\n isPropertyTypeType(type.type) || isExotic(type.type),\n `Invalid data type ${\n JSON.stringify(type)\n } for property ${apiName} on InterfaceType ${apiName}`,\n );\n invariant(\n namespace + apiName === type.apiName\n || apiName === unNamespacedTypeApiName,\n `property key and it's apiName must be identical. ${\n JSON.stringify({ key: apiName, apiName: type.apiName })\n }`,\n );\n return type;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AAEtC,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,EACdC,gBAAgB,QACX,qBAAqB;AAC5B,SAGEC,6BAA6B,QACxB,sCAAsC;AAE7C,SAASC,wCAAwC,QAAQ,yDAAyD;AAClH,SAASC,4BAA4B,QAAQ,6CAA6C;AAC1F,SAASC,QAAQ,EAAEC,kBAAkB,QAAQ,kCAAkC;AA+B/E,OAAO,SAASC,eAAeA,CAC7BC,YAAqC,EACtB;EACf,MAAMC,OAAO,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AAO,IAC/BA,OAAO,KAAK6C,uBAAuB,IAAA1C,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAF1ClB,SAAS,QAGP,oDACE2D,IAAI,CAACC,SAAS,CAAC;IAAEC,GAAG,EAAEhD,OAAO;IAAEA,OAAO,EAAEqB,IAAI,CAACrB;EAAQ,CAAC,CAAC,EACvD,IALJb,SAAS;EAOT,OAAOkC,IAAI;AACb","ignoreList":[]}
|
|
@@ -208,6 +208,12 @@ export function convertObjectStatus(status) {
|
|
|
208
208
|
experimental: {}
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
|
+
if (status === "example") {
|
|
212
|
+
return {
|
|
213
|
+
type: "example",
|
|
214
|
+
example: {}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
211
217
|
if (typeof status === "object" && status.type === "deprecated") {
|
|
212
218
|
return {
|
|
213
219
|
type: "deprecated",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineOntology.js","names":["fs","path","convertActionParameters","convertActionSections","convertActionValidation","convertOntologyDefinition","convertOntologyToValueTypeIr","getFormContentOrdering","createCodeSnippets","OntologyEntityTypeEnum","ontologyDefinition","importedTypes","dependencies","namespace","updateOntology","entity","__type","VALUE_TYPE","apiName","undefined","push","defineOntology","ns","body","outputDir","dependencyFile","codeSnippetFiles","snippetPackageName","snippetFileOutputDir","randomnessKey","OBJECT_TYPE","ACTION_TYPE","LINK_TYPE","INTERFACE_TYPE","SHARED_PROPERTY_TYPE","e","console","error","writeStaticObjects","writeDependencyFile","codegenDir","resolve","typeDirs","existsSync","mkdirSync","recursive","Object","values","forEach","typeDirNameFromMap","currentTypeDirPath","join","rmSync","force","topLevelExportStatements","entries","ontologyTypeEnumKey","entities","typeDirName","typeDirPath","entityModuleNames","entityFileNameBase","camel","withoutNamespace","filePath","entityTypeName","getEntityTypeName","entityJSON","JSON","stringify","replace","_","prefix","value","content","slice","writeFileSync","flag","entityModuleName","length","mainIndexContent","dependencyInjectionString","mainIndexFilePath","buildDatasource","definition","classificationMarkingGroupName","mandatoryMarkingGroupName","needsSecurity","securityConfig","classificationConstraint","markingGroupName","markingConstraint","datasourceName","datasource","editsConfiguration","onlyAllowPrivilegedEdits","redacted","dataSecurity","cleanAndValidateLinkTypeId","step1","linkTypeId","toLowerCase","test","Error","dumpOntologyFullMetadata","dumpValueTypeWireType","convertObjectStatus","status","type","active","experimental","deprecated","message","deadline","replacedBy","convertAction","action","actionValidation","actionParameters","actionSections","parameterOrdering","parameters","map","p","id","actionType","actionTypeLogic","logic","rules","validation","metadata","displayMetadata","configuration","defaultLayout","defaultFormat","displayAndFormat","table","columnWidthByParameterRid","enableFileImport","fitHorizontally","frozenColumnCount","rowHeightInLines","enableLayoutUserSwitch","enableLayoutSwitch","description","displayName","icon","blueprint","locator","color","successMessage","submissionMetadata","typeClasses","submitButtonDisplayMetadata","undoButtonConfiguration","formContentOrdering","sections","extractAllowedValues","allowedValues","oneOf","labelledValues","otherValueAllowed","allowed","min","max","range","minimum","inclusive","maximum","minLength","maxLength","regex","text","failureMessage","datetime","objectTypeReference","interfaceTypeRids","interfaceTypes","geotimeSeriesReference","geotimeSeries","user","filter","fromGroups","group","groupFilter","groupId","staticValue","string","name","parameterId","parameter","multipassGroup","k","renderHintFromBaseType","checkbox","numericInput","userDropdown","textInput","dateTimePicker","filePicker","mandatoryMarkingPicker","cbacMarkingPicker","dropdown","extractNamespace","substring","lastIndexOf","lastDot","str","result","c","toUpperCase","charAt","namespaceNoDot","endsWith","addNamespaceIfNone","includes"],"sources":["defineOntology.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionTypeStatus,\n OntologyIr,\n OntologyIrActionTypeBlockDataV2,\n OntologyIrAllowedParameterValues,\n OntologyIrObjectTypeDatasource,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrParameter,\n OntologyIrSection,\n OntologyIrValueTypeBlockData,\n ParameterId,\n ParameterRenderHint,\n SectionId,\n} from \"@osdk/client.unstable\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { convertActionParameters } from \"../conversion/toMarketplace/convertActionParameters.js\";\nimport { convertActionSections } from \"../conversion/toMarketplace/convertActionSections.js\";\nimport { convertActionValidation } from \"../conversion/toMarketplace/convertActionValidation.js\";\nimport { convertOntologyDefinition } from \"../conversion/toMarketplace/convertOntologyDefinition.js\";\nimport { convertOntologyToValueTypeIr } from \"../conversion/toMarketplace/convertOntologyToValueTypeIr.js\";\nimport { getFormContentOrdering } from \"../conversion/toMarketplace/getFormContentOrdering.js\";\nimport type {\n ActionParameter,\n ActionParameterValidation,\n} from \"./action/ActionParameter.js\";\nimport type { ActionParameterAllowedValues } from \"./action/ActionParameterAllowedValues.js\";\nimport type { ActionType } from \"./action/ActionType.js\";\nimport { createCodeSnippets } from \"./code-snippets/createCodeSnippets.js\";\nimport type { OntologyDefinition } from \"./common/OntologyDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport type { OntologyEntityType } from \"./common/OntologyEntityTypeMapping.js\";\n\n// type -> apiName -> entity\n/** @internal */\nexport let ontologyDefinition: OntologyDefinition;\n\n// type -> apiName -> entity\n/** @internal */\nexport let importedTypes: OntologyDefinition;\n\n// namespace -> version\n/** @internal */\nexport let dependencies: Record<string, string>;\n\n/** @internal */\nexport let namespace: string;\n\nexport function updateOntology<\n T extends OntologyEntityType,\n>(\n entity: T,\n): void {\n if (entity.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {\n ontologyDefinition[entity.__type][entity.apiName] = entity;\n return;\n }\n // value types are a special case\n if (\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName]\n === undefined\n ) {\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] = [];\n }\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName]\n .push(entity);\n}\n\nexport async function defineOntology(\n ns: string,\n body: () => void | Promise<void>,\n outputDir: string | undefined,\n dependencyFile?: string,\n codeSnippetFiles?: boolean,\n snippetPackageName?: string,\n snippetFileOutputDir?: string,\n randomnessKey?: string,\n): Promise<OntologyIr> {\n namespace = ns;\n dependencies = {};\n ontologyDefinition = {\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n SHARED_PROPERTY_TYPE: {},\n VALUE_TYPE: {},\n };\n importedTypes = {\n SHARED_PROPERTY_TYPE: {},\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n VALUE_TYPE: {},\n };\n try {\n await body();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected error while processing the body of the ontology\",\n e,\n );\n throw e;\n }\n if (outputDir) {\n writeStaticObjects(outputDir);\n }\n if (dependencyFile) {\n writeDependencyFile(dependencyFile);\n }\n if (codeSnippetFiles) {\n createCodeSnippets(\n ontologyDefinition,\n snippetPackageName,\n snippetFileOutputDir,\n );\n }\n\n return convertOntologyDefinition(ontologyDefinition, randomnessKey);\n}\n\nexport function writeStaticObjects(outputDir: string): void {\n const codegenDir = path.resolve(outputDir, \"codegen\");\n const typeDirs = {\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"shared-property-types\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"action-types\",\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"object-types\",\n [OntologyEntityTypeEnum.LINK_TYPE]: \"link-types\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"interface-types\",\n [OntologyEntityTypeEnum.VALUE_TYPE]: \"value-types\",\n };\n\n if (!fs.existsSync(codegenDir)) {\n fs.mkdirSync(codegenDir, { recursive: true });\n }\n\n Object.values(typeDirs).forEach(typeDirNameFromMap => {\n const currentTypeDirPath = path.join(codegenDir, typeDirNameFromMap);\n if (fs.existsSync(currentTypeDirPath)) {\n fs.rmSync(currentTypeDirPath, { recursive: true, force: true });\n }\n fs.mkdirSync(currentTypeDirPath, { recursive: true });\n });\n\n const topLevelExportStatements: string[] = [];\n\n Object.entries(ontologyDefinition).forEach(\n ([ontologyTypeEnumKey, entities]) => {\n const typeDirName =\n typeDirs[ontologyTypeEnumKey as OntologyEntityTypeEnum];\n\n const typeDirPath = path.join(codegenDir, typeDirName);\n const entityModuleNames: string[] = [];\n\n Object.entries(entities).forEach(\n ([apiName, entity]: [string, OntologyEntityType]) => {\n const entityFileNameBase = camel(withoutNamespace(apiName))\n + (ontologyTypeEnumKey as OntologyEntityTypeEnum\n === OntologyEntityTypeEnum.VALUE_TYPE\n ? \"ValueType\"\n : \"\");\n const filePath = path.join(typeDirPath, `${entityFileNameBase}.ts`);\n const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);\n const entityJSON = JSON.stringify(entity, null, 2).replace(\n /(\"__type\"\\s*:\\s*)\"([^\"]*)\"/g,\n (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`,\n );\n const content = `\nimport { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\nimport type { ${entityTypeName} } from '@osdk/maker';\n\n/** @type {import('@osdk/maker').${entityTypeName}} */\nconst ${entityFileNameBase}_base: ${entityTypeName} = ${\n ontologyTypeEnumKey === \"VALUE_TYPE\"\n ? entityJSON.slice(1, -2)\n : entityJSON\n } as unknown as ${entityTypeName};\n \nexport const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFileNameBase}_base);\n `;\n fs.writeFileSync(filePath, content, { flag: \"w\" });\n entityModuleNames.push(entityFileNameBase);\n },\n );\n\n for (const entityModuleName of entityModuleNames) {\n topLevelExportStatements.push(\n `export { ${entityModuleName} } from \"./codegen/${typeDirName}/${entityModuleName}.js\";`,\n );\n }\n },\n );\n\n if (topLevelExportStatements.length > 0) {\n const mainIndexContent = dependencyInjectionString()\n + topLevelExportStatements.join(\"\\n\") + \"\\n\";\n const mainIndexFilePath = path.join(outputDir, \"index.ts\");\n fs.writeFileSync(mainIndexFilePath, mainIndexContent, { flag: \"w\" });\n }\n}\n\nexport function buildDatasource(\n apiName: string,\n definition: OntologyIrObjectTypeDatasourceDefinition,\n classificationMarkingGroupName?: string,\n mandatoryMarkingGroupName?: string,\n): OntologyIrObjectTypeDatasource {\n const needsSecurity = classificationMarkingGroupName !== undefined\n || mandatoryMarkingGroupName !== undefined;\n\n const securityConfig = needsSecurity\n ? {\n classificationConstraint: classificationMarkingGroupName\n ? {\n markingGroupName: classificationMarkingGroupName,\n }\n : undefined,\n markingConstraint: mandatoryMarkingGroupName\n ? {\n markingGroupName: mandatoryMarkingGroupName,\n }\n : undefined,\n }\n : undefined;\n return ({\n datasourceName: apiName,\n datasource: definition,\n editsConfiguration: {\n onlyAllowPrivilegedEdits: false,\n },\n redacted: false,\n ...((securityConfig !== undefined) && { dataSecurity: securityConfig }),\n });\n}\n\nexport function cleanAndValidateLinkTypeId(apiName: string): string {\n // Insert a dash before any uppercase letter that follows a lowercase letter or digit\n const step1 = apiName.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\");\n // Insert a dash after a sequence of uppercase letters when followed by a lowercase letter\n // then convert the whole string to lowercase\n // e.g., apiName, APIname, and apiNAME will all be converted to api-name\n const linkTypeId = step1.replace(/([A-Z])([A-Z][a-z])/g, \"$1-$2\")\n .toLowerCase();\n\n const VALIDATION_PATTERN = /^([a-z][a-z0-9\\-]*)$/;\n if (!VALIDATION_PATTERN.test(linkTypeId)) {\n throw new Error(\n `LinkType id '${linkTypeId}' must be lower case with dashes.`,\n );\n }\n return linkTypeId;\n}\n\nexport function dumpOntologyFullMetadata(): OntologyIr {\n return convertOntologyDefinition(ontologyDefinition);\n}\n\nexport function dumpValueTypeWireType(): OntologyIrValueTypeBlockData {\n return convertOntologyToValueTypeIr(ontologyDefinition);\n}\n\nexport function convertObjectStatus(status: any): any {\n if (status === undefined) {\n return {\n type: \"active\",\n active: {},\n };\n }\n\n if (status === \"active\") {\n return {\n type: \"active\",\n active: {},\n };\n }\n\n if (status === \"experimental\") {\n return {\n type: \"experimental\",\n experimental: {},\n };\n }\n\n if (typeof status === \"object\" && status.type === \"deprecated\") {\n return {\n type: \"deprecated\",\n deprecated: {\n message: status.message,\n deadline: status.deadline,\n replacedBy: undefined,\n },\n };\n }\n\n return status;\n}\n\nexport function convertAction(\n action: ActionType,\n): OntologyIrActionTypeBlockDataV2 {\n const actionValidation = convertActionValidation(action);\n const actionParameters: Record<ParameterId, OntologyIrParameter> =\n convertActionParameters(action);\n const actionSections: Record<SectionId, OntologyIrSection> =\n convertActionSections(action);\n const parameterOrdering = action.parameterOrdering\n ?? (action.parameters ?? []).map(p => p.id);\n return {\n actionType: {\n actionTypeLogic: {\n logic: {\n rules: action.rules,\n },\n validation: actionValidation,\n },\n metadata: {\n apiName: action.apiName,\n displayMetadata: {\n configuration: {\n defaultLayout: action.defaultFormat ?? \"FORM\",\n displayAndFormat: action.displayAndFormat ?? {\n table: {\n columnWidthByParameterRid: {},\n enableFileImport: true,\n fitHorizontally: false,\n frozenColumnCount: 0,\n rowHeightInLines: 1,\n },\n },\n enableLayoutUserSwitch: action.enableLayoutSwitch ?? false,\n },\n description: action.description ?? \"\",\n displayName: action.displayName,\n icon: {\n type: \"blueprint\",\n blueprint: action.icon ?? { locator: \"edit\", color: \"#000000\" },\n },\n successMessage: action.submissionMetadata?.successMessage\n ? [{\n type: \"message\",\n message: action.submissionMetadata.successMessage,\n }]\n : [],\n typeClasses: action.typeClasses ?? [],\n ...(action.submissionMetadata?.submitButtonDisplayMetadata\n && {\n submitButtonDisplayMetadata:\n action.submissionMetadata.submitButtonDisplayMetadata,\n }),\n ...(action.submissionMetadata?.undoButtonConfiguration\n && {\n undoButtonConfiguration:\n action.submissionMetadata.undoButtonConfiguration,\n }),\n },\n parameterOrdering: parameterOrdering,\n formContentOrdering: getFormContentOrdering(action, parameterOrdering),\n parameters: actionParameters,\n sections: actionSections,\n status: typeof action.status === \"string\"\n ? {\n type: action.status,\n [action.status]: {},\n } as unknown as ActionTypeStatus\n : action.status,\n entities: action.entities,\n },\n },\n };\n}\n\nexport function extractAllowedValues(\n allowedValues: ActionParameterAllowedValues,\n): OntologyIrAllowedParameterValues {\n switch (allowedValues.type) {\n case \"oneOf\":\n return {\n type: \"oneOf\",\n oneOf: {\n type: \"oneOf\",\n oneOf: {\n labelledValues: allowedValues.oneOf,\n otherValueAllowed: {\n allowed: allowedValues.otherValueAllowed\n ?? false,\n },\n },\n },\n };\n case \"range\":\n const { min, max } = allowedValues;\n return {\n type: \"range\",\n range: {\n type: \"range\",\n range: {\n ...(min === undefined\n ? {}\n : { minimum: { inclusive: true, value: min } }),\n ...(max === undefined\n ? {}\n : { maximum: { inclusive: true, value: max } }),\n },\n },\n };\n case \"text\":\n const { minLength, maxLength, regex } = allowedValues;\n return {\n type: \"text\",\n text: {\n type: \"text\",\n text: {\n ...(minLength === undefined\n ? {}\n : { minLength: minLength }),\n ...(maxLength === undefined\n ? {}\n : { maxLength: maxLength }),\n ...(regex === undefined\n ? {}\n : { regex: { regex: regex, failureMessage: \"Invalid input\" } }),\n },\n },\n };\n case \"datetime\":\n const { minimum, maximum } = allowedValues;\n return {\n type: \"datetime\",\n datetime: {\n type: \"datetime\",\n datetime: {\n minimum,\n maximum,\n },\n },\n };\n case \"objectTypeReference\":\n return {\n type: \"objectTypeReference\",\n objectTypeReference: {\n type: \"objectTypeReference\",\n objectTypeReference: {\n interfaceTypeRids: allowedValues.interfaceTypes,\n },\n },\n };\n case \"redacted\":\n return {\n type: \"redacted\",\n redacted: {},\n };\n case \"geotimeSeriesReference\":\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {\n type: \"geotimeSeries\",\n geotimeSeries: {},\n },\n };\n case \"user\":\n return {\n type: \"user\",\n user: {\n type: \"user\",\n user: {\n filter: (allowedValues.fromGroups ?? []).map(group => {\n return {\n type: \"groupFilter\",\n groupFilter: {\n groupId: group.type === \"static\"\n ? {\n type: \"staticValue\",\n staticValue: {\n type: \"string\",\n string: group.name,\n },\n }\n : {\n type: \"parameterId\",\n parameterId: group.parameter,\n },\n },\n };\n }),\n },\n },\n };\n case \"multipassGroup\":\n return {\n type: \"multipassGroup\",\n multipassGroup: {\n type: \"group\",\n group: {},\n },\n };\n default:\n const k: Partial<OntologyIrAllowedParameterValues[\"type\"]> =\n allowedValues.type;\n return {\n type: k,\n [k]: {\n type: k,\n [k]: {},\n },\n } as unknown as OntologyIrAllowedParameterValues;\n // TODO(dpaquin): there's probably a TS clean way to do this\n }\n}\n\nexport function renderHintFromBaseType(\n parameter: ActionParameter,\n validation?: ActionParameterValidation,\n): ParameterRenderHint {\n // TODO(dpaquin): these are just guesses, we should find where they're actually defined\n const type = typeof parameter.type === \"string\"\n ? parameter.type\n : parameter.type.type;\n switch (type) {\n case \"boolean\":\n case \"booleanList\":\n return { type: \"checkbox\", checkbox: {} };\n case \"integer\":\n case \"integerList\":\n case \"long\":\n case \"longList\":\n case \"double\":\n case \"doubleList\":\n case \"decimal\":\n case \"decimalList\":\n return { type: \"numericInput\", numericInput: {} };\n case \"string\":\n if (\n validation?.allowedValues?.type === \"user\"\n || validation?.allowedValues?.type === \"multipassGroup\"\n ) {\n return { type: \"userDropdown\", userDropdown: {} };\n }\n case \"stringList\":\n case \"geohash\":\n case \"geohashList\":\n case \"geoshape\":\n case \"geoshapeList\":\n case \"objectSetRid\":\n return { type: \"textInput\", textInput: {} };\n case \"timestamp\":\n case \"timestampList\":\n case \"date\":\n case \"dateList\":\n return { type: \"dateTimePicker\", dateTimePicker: {} };\n case \"attachment\":\n case \"attachmentList\":\n return { type: \"filePicker\", filePicker: {} };\n case \"marking\":\n case \"markingList\":\n if (parameter.validation.allowedValues?.type === \"mandatoryMarking\") {\n return { type: \"mandatoryMarkingPicker\", mandatoryMarkingPicker: {} };\n } else if (parameter.validation.allowedValues?.type === \"cbacMarking\") {\n return { type: \"cbacMarkingPicker\", cbacMarkingPicker: {} };\n } else {\n throw new Error(\n `The allowed values for \"${parameter.displayName}\" are not compatible with the base parameter type`,\n );\n }\n case \"timeSeriesReference\":\n case \"objectReference\":\n case \"objectReferenceList\":\n case \"interfaceReference\":\n case \"interfaceReferenceList\":\n case \"objectTypeReference\":\n case \"mediaReference\":\n case \"mediaReferenceList\":\n case \"geotimeSeriesReference\":\n case \"geotimeSeriesReferenceList\":\n return { type: \"dropdown\", dropdown: {} };\n case \"struct\":\n case \"structList\":\n throw new Error(\"Structs are not supported yet\");\n default:\n throw new Error(`Unknown type ${type}`);\n }\n}\n\nexport function extractNamespace(apiName: string): string {\n return apiName.substring(0, apiName.lastIndexOf(\".\") + 1);\n}\n\nexport function withoutNamespace(apiName: string): string {\n const lastDot = apiName.lastIndexOf(\".\");\n if (lastDot === -1) {\n return apiName;\n }\n return apiName.substring(lastDot + 1);\n}\n\nfunction camel(str: string): string {\n if (!str) {\n return str;\n }\n let result = str.replace(/[-_]+(.)?/g, (_, c) => (c ? c.toUpperCase() : \"\"));\n result = result.charAt(0).toLowerCase() + result.slice(1);\n return result;\n}\n\n/**\n * Gets the TypeScript type name corresponding to an OntologyEntityTypeEnum value\n */\nfunction getEntityTypeName(type: string): string {\n return {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"ObjectType\",\n [OntologyEntityTypeEnum.LINK_TYPE]: \"LinkType\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"InterfaceType\",\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"SharedPropertyType\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"ActionType\",\n [OntologyEntityTypeEnum.VALUE_TYPE]: \"ValueTypeDefinitionVersion\",\n }[type]!;\n}\n\nfunction writeDependencyFile(dependencyFile: string): void {\n fs.writeFileSync(dependencyFile, JSON.stringify(dependencies, null, 2));\n}\n\nfunction dependencyInjectionString(): string {\n const namespaceNoDot: string = namespace.endsWith(\".\")\n ? namespace.slice(0, -1)\n : namespace;\n\n return `import { addDependency } from \"@osdk/maker\";\n// @ts-ignore\naddDependency(\"${namespaceNoDot}\", new URL(import.meta.url).pathname);\n`;\n}\n\nexport function addNamespaceIfNone(apiName: string): string {\n return apiName.includes(\".\") ? apiName : namespace + apiName;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAO,KAAKA,EAAE,MAAM,IAAI;AACxB,OAAO,KAAKC,IAAI,MAAM,MAAM;AAC5B,SAASC,uBAAuB,QAAQ,wDAAwD;AAChG,SAASC,qBAAqB,QAAQ,sDAAsD;AAC5F,SAASC,uBAAuB,QAAQ,wDAAwD;AAChG,SAASC,yBAAyB,QAAQ,0DAA0D;AACpG,SAASC,4BAA4B,QAAQ,6DAA6D;AAC1G,SAASC,sBAAsB,QAAQ,uDAAuD;AAO9F,SAASC,kBAAkB,QAAQ,uCAAuC;AAE1E,SAASC,sBAAsB,QAAQ,oCAAoC;AAG3E;AACA;AACA,OAAO,IAAIC,kBAAsC;;AAEjD;AACA;AACA,OAAO,IAAIC,aAAiC;;AAE5C;AACA;AACA,OAAO,IAAIC,YAAoC;;AAE/C;AACA,OAAO,IAAIC,SAAiB;AAE5B,OAAO,SAASC,cAAcA,CAG5BC,MAAS,EACH;EACN,IAAIA,MAAM,CAACC,MAAM,KAAKP,sBAAsB,CAACQ,UAAU,EAAE;IACvDP,kBAAkB,CAACK,MAAM,CAACC,MAAM,CAAC,CAACD,MAAM,CAACG,OAAO,CAAC,GAAGH,MAAM;IAC1D;EACF;EACA;EACA,IACEL,kBAAkB,CAACD,sBAAsB,CAACQ,UAAU,CAA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AAS,CAACzD,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzE;AAEA,SAASqE,yBAAyBA,CAAA,EAAW;EAC3C,MAAMmI,cAAsB,GAAGvM,SAAS,CAACwM,QAAQ,CAAC,GAAG,CAAC,GAClDxM,SAAS,CAAC8D,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACtB9D,SAAS;EAEb,OAAO;AACT;AACA,iBAAiBuM,cAAc;AAC/B,CAAC;AACD;AAEA,OAAO,SAASE,kBAAkBA,CAACpM,OAAe,EAAU;EAC1D,OAAOA,OAAO,CAACqM,QAAQ,CAAC,GAAG,CAAC,GAAGrM,OAAO,GAAGL,SAAS,GAAGK,OAAO;AAC9D","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"defineOntology.js","names":["fs","path","convertActionParameters","convertActionSections","convertActionValidation","convertOntologyDefinition","convertOntologyToValueTypeIr","getFormContentOrdering","createCodeSnippets","OntologyEntityTypeEnum","ontologyDefinition","importedTypes","dependencies","namespace","updateOntology","entity","__type","VALUE_TYPE","apiName","undefined","push","defineOntology","ns","body","outputDir","dependencyFile","codeSnippetFiles","snippetPackageName","snippetFileOutputDir","randomnessKey","OBJECT_TYPE","ACTION_TYPE","LINK_TYPE","INTERFACE_TYPE","SHARED_PROPERTY_TYPE","e","console","error","writeStaticObjects","writeDependencyFile","codegenDir","resolve","typeDirs","existsSync","mkdirSync","recursive","Object","values","forEach","typeDirNameFromMap","currentTypeDirPath","join","rmSync","force","topLevelExportStatements","entries","ontologyTypeEnumKey","entities","typeDirName","typeDirPath","entityModuleNames","entityFileNameBase","camel","withoutNamespace","filePath","entityTypeName","getEntityTypeName","entityJSON","JSON","stringify","replace","_","prefix","value","content","slice","writeFileSync","flag","entityModuleName","length","mainIndexContent","dependencyInjectionString","mainIndexFilePath","buildDatasource","definition","classificationMarkingGroupName","mandatoryMarkingGroupName","needsSecurity","securityConfig","classificationConstraint","markingGroupName","markingConstraint","datasourceName","datasource","editsConfiguration","onlyAllowPrivilegedEdits","redacted","dataSecurity","cleanAndValidateLinkTypeId","step1","linkTypeId","toLowerCase","test","Error","dumpOntologyFullMetadata","dumpValueTypeWireType","convertObjectStatus","status","type","active","experimental","example","deprecated","message","deadline","replacedBy","convertAction","action","actionValidation","actionParameters","actionSections","parameterOrdering","parameters","map","p","id","actionType","actionTypeLogic","logic","rules","validation","metadata","displayMetadata","configuration","defaultLayout","defaultFormat","displayAndFormat","table","columnWidthByParameterRid","enableFileImport","fitHorizontally","frozenColumnCount","rowHeightInLines","enableLayoutUserSwitch","enableLayoutSwitch","description","displayName","icon","blueprint","locator","color","successMessage","submissionMetadata","typeClasses","submitButtonDisplayMetadata","undoButtonConfiguration","formContentOrdering","sections","extractAllowedValues","allowedValues","oneOf","labelledValues","otherValueAllowed","allowed","min","max","range","minimum","inclusive","maximum","minLength","maxLength","regex","text","failureMessage","datetime","objectTypeReference","interfaceTypeRids","interfaceTypes","geotimeSeriesReference","geotimeSeries","user","filter","fromGroups","group","groupFilter","groupId","staticValue","string","name","parameterId","parameter","multipassGroup","k","renderHintFromBaseType","checkbox","numericInput","userDropdown","textInput","dateTimePicker","filePicker","mandatoryMarkingPicker","cbacMarkingPicker","dropdown","extractNamespace","substring","lastIndexOf","lastDot","str","result","c","toUpperCase","charAt","namespaceNoDot","endsWith","addNamespaceIfNone","includes"],"sources":["defineOntology.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionTypeStatus,\n OntologyIr,\n OntologyIrActionTypeBlockDataV2,\n OntologyIrAllowedParameterValues,\n OntologyIrObjectTypeDatasource,\n OntologyIrObjectTypeDatasourceDefinition,\n OntologyIrParameter,\n OntologyIrSection,\n OntologyIrValueTypeBlockData,\n ParameterId,\n ParameterRenderHint,\n SectionId,\n} from \"@osdk/client.unstable\";\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { convertActionParameters } from \"../conversion/toMarketplace/convertActionParameters.js\";\nimport { convertActionSections } from \"../conversion/toMarketplace/convertActionSections.js\";\nimport { convertActionValidation } from \"../conversion/toMarketplace/convertActionValidation.js\";\nimport { convertOntologyDefinition } from \"../conversion/toMarketplace/convertOntologyDefinition.js\";\nimport { convertOntologyToValueTypeIr } from \"../conversion/toMarketplace/convertOntologyToValueTypeIr.js\";\nimport { getFormContentOrdering } from \"../conversion/toMarketplace/getFormContentOrdering.js\";\nimport type {\n ActionParameter,\n ActionParameterValidation,\n} from \"./action/ActionParameter.js\";\nimport type { ActionParameterAllowedValues } from \"./action/ActionParameterAllowedValues.js\";\nimport type { ActionType } from \"./action/ActionType.js\";\nimport { createCodeSnippets } from \"./code-snippets/createCodeSnippets.js\";\nimport type { OntologyDefinition } from \"./common/OntologyDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport type { OntologyEntityType } from \"./common/OntologyEntityTypeMapping.js\";\n\n// type -> apiName -> entity\n/** @internal */\nexport let ontologyDefinition: OntologyDefinition;\n\n// type -> apiName -> entity\n/** @internal */\nexport let importedTypes: OntologyDefinition;\n\n// namespace -> version\n/** @internal */\nexport let dependencies: Record<string, string>;\n\n/** @internal */\nexport let namespace: string;\n\nexport function updateOntology<\n T extends OntologyEntityType,\n>(\n entity: T,\n): void {\n if (entity.__type !== OntologyEntityTypeEnum.VALUE_TYPE) {\n ontologyDefinition[entity.__type][entity.apiName] = entity;\n return;\n }\n // value types are a special case\n if (\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName]\n === undefined\n ) {\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName] = [];\n }\n ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][entity.apiName]\n .push(entity);\n}\n\nexport async function defineOntology(\n ns: string,\n body: () => void | Promise<void>,\n outputDir: string | undefined,\n dependencyFile?: string,\n codeSnippetFiles?: boolean,\n snippetPackageName?: string,\n snippetFileOutputDir?: string,\n randomnessKey?: string,\n): Promise<OntologyIr> {\n namespace = ns;\n dependencies = {};\n ontologyDefinition = {\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n SHARED_PROPERTY_TYPE: {},\n VALUE_TYPE: {},\n };\n importedTypes = {\n SHARED_PROPERTY_TYPE: {},\n OBJECT_TYPE: {},\n ACTION_TYPE: {},\n LINK_TYPE: {},\n INTERFACE_TYPE: {},\n VALUE_TYPE: {},\n };\n try {\n await body();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected error while processing the body of the ontology\",\n e,\n );\n throw e;\n }\n if (outputDir) {\n writeStaticObjects(outputDir);\n }\n if (dependencyFile) {\n writeDependencyFile(dependencyFile);\n }\n if (codeSnippetFiles) {\n createCodeSnippets(\n ontologyDefinition,\n snippetPackageName,\n snippetFileOutputDir,\n );\n }\n\n return convertOntologyDefinition(ontologyDefinition, randomnessKey);\n}\n\nexport function writeStaticObjects(outputDir: string): void {\n const codegenDir = path.resolve(outputDir, \"codegen\");\n const typeDirs = {\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"shared-property-types\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"action-types\",\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"object-types\",\n [OntologyEntityTypeEnum.LINK_TYPE]: \"link-types\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"interface-types\",\n [OntologyEntityTypeEnum.VALUE_TYPE]: \"value-types\",\n };\n\n if (!fs.existsSync(codegenDir)) {\n fs.mkdirSync(codegenDir, { recursive: true });\n }\n\n Object.values(typeDirs).forEach(typeDirNameFromMap => {\n const currentTypeDirPath = path.join(codegenDir, typeDirNameFromMap);\n if (fs.existsSync(currentTypeDirPath)) {\n fs.rmSync(currentTypeDirPath, { recursive: true, force: true });\n }\n fs.mkdirSync(currentTypeDirPath, { recursive: true });\n });\n\n const topLevelExportStatements: string[] = [];\n\n Object.entries(ontologyDefinition).forEach(\n ([ontologyTypeEnumKey, entities]) => {\n const typeDirName =\n typeDirs[ontologyTypeEnumKey as OntologyEntityTypeEnum];\n\n const typeDirPath = path.join(codegenDir, typeDirName);\n const entityModuleNames: string[] = [];\n\n Object.entries(entities).forEach(\n ([apiName, entity]: [string, OntologyEntityType]) => {\n const entityFileNameBase = camel(withoutNamespace(apiName))\n + (ontologyTypeEnumKey as OntologyEntityTypeEnum\n === OntologyEntityTypeEnum.VALUE_TYPE\n ? \"ValueType\"\n : \"\");\n const filePath = path.join(typeDirPath, `${entityFileNameBase}.ts`);\n const entityTypeName = getEntityTypeName(ontologyTypeEnumKey);\n const entityJSON = JSON.stringify(entity, null, 2).replace(\n /(\"__type\"\\s*:\\s*)\"([^\"]*)\"/g,\n (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`,\n );\n const content = `\nimport { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\nimport type { ${entityTypeName} } from '@osdk/maker';\n\n/** @type {import('@osdk/maker').${entityTypeName}} */\nconst ${entityFileNameBase}_base: ${entityTypeName} = ${\n ontologyTypeEnumKey === \"VALUE_TYPE\"\n ? entityJSON.slice(1, -2)\n : entityJSON\n } as unknown as ${entityTypeName};\n \nexport const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFileNameBase}_base);\n `;\n fs.writeFileSync(filePath, content, { flag: \"w\" });\n entityModuleNames.push(entityFileNameBase);\n },\n );\n\n for (const entityModuleName of entityModuleNames) {\n topLevelExportStatements.push(\n `export { ${entityModuleName} } from \"./codegen/${typeDirName}/${entityModuleName}.js\";`,\n );\n }\n },\n );\n\n if (topLevelExportStatements.length > 0) {\n const mainIndexContent = dependencyInjectionString()\n + topLevelExportStatements.join(\"\\n\") + \"\\n\";\n const mainIndexFilePath = path.join(outputDir, \"index.ts\");\n fs.writeFileSync(mainIndexFilePath, mainIndexContent, { flag: \"w\" });\n }\n}\n\nexport function buildDatasource(\n apiName: string,\n definition: OntologyIrObjectTypeDatasourceDefinition,\n classificationMarkingGroupName?: string,\n mandatoryMarkingGroupName?: string,\n): OntologyIrObjectTypeDatasource {\n const needsSecurity = classificationMarkingGroupName !== undefined\n || mandatoryMarkingGroupName !== undefined;\n\n const securityConfig = needsSecurity\n ? {\n classificationConstraint: classificationMarkingGroupName\n ? {\n markingGroupName: classificationMarkingGroupName,\n }\n : undefined,\n markingConstraint: mandatoryMarkingGroupName\n ? {\n markingGroupName: mandatoryMarkingGroupName,\n }\n : undefined,\n }\n : undefined;\n return ({\n datasourceName: apiName,\n datasource: definition,\n editsConfiguration: {\n onlyAllowPrivilegedEdits: false,\n },\n redacted: false,\n ...((securityConfig !== undefined) && { dataSecurity: securityConfig }),\n });\n}\n\nexport function cleanAndValidateLinkTypeId(apiName: string): string {\n // Insert a dash before any uppercase letter that follows a lowercase letter or digit\n const step1 = apiName.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\");\n // Insert a dash after a sequence of uppercase letters when followed by a lowercase letter\n // then convert the whole string to lowercase\n // e.g., apiName, APIname, and apiNAME will all be converted to api-name\n const linkTypeId = step1.replace(/([A-Z])([A-Z][a-z])/g, \"$1-$2\")\n .toLowerCase();\n\n const VALIDATION_PATTERN = /^([a-z][a-z0-9\\-]*)$/;\n if (!VALIDATION_PATTERN.test(linkTypeId)) {\n throw new Error(\n `LinkType id '${linkTypeId}' must be lower case with dashes.`,\n );\n }\n return linkTypeId;\n}\n\nexport function dumpOntologyFullMetadata(): OntologyIr {\n return convertOntologyDefinition(ontologyDefinition);\n}\n\nexport function dumpValueTypeWireType(): OntologyIrValueTypeBlockData {\n return convertOntologyToValueTypeIr(ontologyDefinition);\n}\n\nexport function convertObjectStatus(status: any): any {\n if (status === undefined) {\n return {\n type: \"active\",\n active: {},\n };\n }\n\n if (status === \"active\") {\n return {\n type: \"active\",\n active: {},\n };\n }\n\n if (status === \"experimental\") {\n return {\n type: \"experimental\",\n experimental: {},\n };\n }\n\n if (status === \"example\") {\n return {\n type: \"example\",\n example: {},\n };\n }\n\n if (typeof status === \"object\" && status.type === \"deprecated\") {\n return {\n type: \"deprecated\",\n deprecated: {\n message: status.message,\n deadline: status.deadline,\n replacedBy: undefined,\n },\n };\n }\n\n return status;\n}\n\nexport function convertAction(\n action: ActionType,\n): OntologyIrActionTypeBlockDataV2 {\n const actionValidation = convertActionValidation(action);\n const actionParameters: Record<ParameterId, OntologyIrParameter> =\n convertActionParameters(action);\n const actionSections: Record<SectionId, OntologyIrSection> =\n convertActionSections(action);\n const parameterOrdering = action.parameterOrdering\n ?? (action.parameters ?? []).map(p => p.id);\n return {\n actionType: {\n actionTypeLogic: {\n logic: {\n rules: action.rules,\n },\n validation: actionValidation,\n },\n metadata: {\n apiName: action.apiName,\n displayMetadata: {\n configuration: {\n defaultLayout: action.defaultFormat ?? \"FORM\",\n displayAndFormat: action.displayAndFormat ?? {\n table: {\n columnWidthByParameterRid: {},\n enableFileImport: true,\n fitHorizontally: false,\n frozenColumnCount: 0,\n rowHeightInLines: 1,\n },\n },\n enableLayoutUserSwitch: action.enableLayoutSwitch ?? false,\n },\n description: action.description ?? \"\",\n displayName: action.displayName,\n icon: {\n type: \"blueprint\",\n blueprint: action.icon ?? { locator: \"edit\", color: \"#000000\" },\n },\n successMessage: action.submissionMetadata?.successMessage\n ? [{\n type: \"message\",\n message: action.submissionMetadata.successMessage,\n }]\n : [],\n typeClasses: action.typeClasses ?? [],\n ...(action.submissionMetadata?.submitButtonDisplayMetadata\n && {\n submitButtonDisplayMetadata:\n action.submissionMetadata.submitButtonDisplayMetadata,\n }),\n ...(action.submissionMetadata?.undoButtonConfiguration\n && {\n undoButtonConfiguration:\n action.submissionMetadata.undoButtonConfiguration,\n }),\n },\n parameterOrdering: parameterOrdering,\n formContentOrdering: getFormContentOrdering(action, parameterOrdering),\n parameters: actionParameters,\n sections: actionSections,\n status: typeof action.status === \"string\"\n ? {\n type: action.status,\n [action.status]: {},\n } as unknown as ActionTypeStatus\n : action.status,\n entities: action.entities,\n },\n },\n };\n}\n\nexport function extractAllowedValues(\n allowedValues: ActionParameterAllowedValues,\n): OntologyIrAllowedParameterValues {\n switch (allowedValues.type) {\n case \"oneOf\":\n return {\n type: \"oneOf\",\n oneOf: {\n type: \"oneOf\",\n oneOf: {\n labelledValues: allowedValues.oneOf,\n otherValueAllowed: {\n allowed: allowedValues.otherValueAllowed\n ?? false,\n },\n },\n },\n };\n case \"range\":\n const { min, max } = allowedValues;\n return {\n type: \"range\",\n range: {\n type: \"range\",\n range: {\n ...(min === undefined\n ? {}\n : { minimum: { inclusive: true, value: min } }),\n ...(max === undefined\n ? {}\n : { maximum: { inclusive: true, value: max } }),\n },\n },\n };\n case \"text\":\n const { minLength, maxLength, regex } = allowedValues;\n return {\n type: \"text\",\n text: {\n type: \"text\",\n text: {\n ...(minLength === undefined\n ? {}\n : { minLength: minLength }),\n ...(maxLength === undefined\n ? {}\n : { maxLength: maxLength }),\n ...(regex === undefined\n ? {}\n : { regex: { regex: regex, failureMessage: \"Invalid input\" } }),\n },\n },\n };\n case \"datetime\":\n const { minimum, maximum } = allowedValues;\n return {\n type: \"datetime\",\n datetime: {\n type: \"datetime\",\n datetime: {\n minimum,\n maximum,\n },\n },\n };\n case \"objectTypeReference\":\n return {\n type: \"objectTypeReference\",\n objectTypeReference: {\n type: \"objectTypeReference\",\n objectTypeReference: {\n interfaceTypeRids: allowedValues.interfaceTypes,\n },\n },\n };\n case \"redacted\":\n return {\n type: \"redacted\",\n redacted: {},\n };\n case \"geotimeSeriesReference\":\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {\n type: \"geotimeSeries\",\n geotimeSeries: {},\n },\n };\n case \"user\":\n return {\n type: \"user\",\n user: {\n type: \"user\",\n user: {\n filter: (allowedValues.fromGroups ?? []).map(group => {\n return {\n type: \"groupFilter\",\n groupFilter: {\n groupId: group.type === \"static\"\n ? {\n type: \"staticValue\",\n staticValue: {\n type: \"string\",\n string: group.name,\n },\n }\n : {\n type: \"parameterId\",\n parameterId: group.parameter,\n },\n },\n };\n }),\n },\n },\n };\n case \"multipassGroup\":\n return {\n type: \"multipassGroup\",\n multipassGroup: {\n type: \"group\",\n group: {},\n },\n };\n default:\n const k: Partial<OntologyIrAllowedParameterValues[\"type\"]> =\n allowedValues.type;\n return {\n type: k,\n [k]: {\n type: k,\n [k]: {},\n },\n } as unknown as OntologyIrAllowedParameterValues;\n // TODO(dpaquin): there's probably a TS clean way to do this\n }\n}\n\nexport function renderHintFromBaseType(\n parameter: ActionParameter,\n validation?: ActionParameterValidation,\n): ParameterRenderHint {\n // TODO(dpaquin): these are just guesses, we should find where they're actually defined\n const type = typeof parameter.type === \"string\"\n ? parameter.type\n : parameter.type.type;\n switch (type) {\n case \"boolean\":\n case \"booleanList\":\n return { type: \"checkbox\", checkbox: {} };\n case \"integer\":\n case \"integerList\":\n case \"long\":\n case \"longList\":\n case \"double\":\n case \"doubleList\":\n case \"decimal\":\n case \"decimalList\":\n return { type: \"numericInput\", numericInput: {} };\n case \"string\":\n if (\n validation?.allowedValues?.type === \"user\"\n || validation?.allowedValues?.type === \"multipassGroup\"\n ) {\n return { type: \"userDropdown\", userDropdown: {} };\n }\n case \"stringList\":\n case \"geohash\":\n case \"geohashList\":\n case \"geoshape\":\n case \"geoshapeList\":\n case \"objectSetRid\":\n return { type: \"textInput\", textInput: {} };\n case \"timestamp\":\n case \"timestampList\":\n case \"date\":\n case \"dateList\":\n return { type: \"dateTimePicker\", dateTimePicker: {} };\n case \"attachment\":\n case \"attachmentList\":\n return { type: \"filePicker\", filePicker: {} };\n case \"marking\":\n case \"markingList\":\n if (parameter.validation.allowedValues?.type === \"mandatoryMarking\") {\n return { type: \"mandatoryMarkingPicker\", mandatoryMarkingPicker: {} };\n } else if (parameter.validation.allowedValues?.type === \"cbacMarking\") {\n return { type: \"cbacMarkingPicker\", cbacMarkingPicker: {} };\n } else {\n throw new Error(\n `The allowed values for \"${parameter.displayName}\" are not compatible with the base parameter type`,\n );\n }\n case \"timeSeriesReference\":\n case \"objectReference\":\n case \"objectReferenceList\":\n case \"interfaceReference\":\n case \"interfaceReferenceList\":\n case \"objectTypeReference\":\n case \"mediaReference\":\n case \"mediaReferenceList\":\n case \"geotimeSeriesReference\":\n case \"geotimeSeriesReferenceList\":\n return { type: \"dropdown\", dropdown: {} };\n case \"struct\":\n case \"structList\":\n throw new Error(\"Structs are not supported yet\");\n default:\n throw new Error(`Unknown type ${type}`);\n }\n}\n\nexport function extractNamespace(apiName: string): string {\n return apiName.substring(0, apiName.lastIndexOf(\".\") + 1);\n}\n\nexport function withoutNamespace(apiName: string): string {\n const lastDot = apiName.lastIndexOf(\".\");\n if (lastDot === -1) {\n return apiName;\n }\n return apiName.substring(lastDot + 1);\n}\n\nfunction camel(str: string): string {\n if (!str) {\n return str;\n }\n let result = str.replace(/[-_]+(.)?/g, (_, c) => (c ? c.toUpperCase() : \"\"));\n result = result.charAt(0).toLowerCase() + result.slice(1);\n return result;\n}\n\n/**\n * Gets the TypeScript type name corresponding to an OntologyEntityTypeEnum value\n */\nfunction getEntityTypeName(type: string): string {\n return {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"ObjectType\",\n [OntologyEntityTypeEnum.LINK_TYPE]: \"LinkType\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"InterfaceType\",\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"SharedPropertyType\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"ActionType\",\n [OntologyEntityTypeEnum.VALUE_TYPE]: \"ValueTypeDefinitionVersion\",\n }[type]!;\n}\n\nfunction writeDependencyFile(dependencyFile: string): void {\n fs.writeFileSync(dependencyFile, JSON.stringify(dependencies, null, 2));\n}\n\nfunction dependencyInjectionString(): string {\n const namespaceNoDot: string = namespace.endsWith(\".\")\n ? namespace.slice(0, -1)\n : namespace;\n\n return `import { addDependency } from \"@osdk/maker\";\n// @ts-ignore\naddDependency(\"${namespaceNoDot}\", new URL(import.meta.url).pathname);\n`;\n}\n\nexport function addNamespaceIfNone(apiName: string): string {\n return apiName.includes(\".\") ? apiName : namespace + apiName;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAO,KAAKA,EAAE,MAAM,IAAI;AACxB,OAAO,KAAKC,IAAI,MAAM,MAAM;AAC5B,SAASC,uBAAuB,QAAQ,wDAAwD;AAChG,SAASC,qBAAqB,QAAQ,sDAAsD;AAC5F,SAASC,uBAAuB,QAAQ,wDAAwD;AAChG,SAASC,yBAAyB,QAAQ,0DAA0D;AACpG,SAASC,4BAA4B,QAAQ,6DAA6D;AAC1G,SAASC,sBAAsB,QAAQ,uDAAuD;AAO9F,SAASC,kBAAkB,QAAQ,uCAAuC;AAE1E,SAASC,sBAAsB,QAAQ,oCAAoC;AAG3E;AACA;AACA,OAAO,IAAIC,kBAAsC;;AAEjD;AACA;AACA,OAAO,IAAIC,aAAiC;;AAE5C;AACA;AACA,OAAO,IAAIC,YAAoC;;AAE/C;AACA,OAAO,IAAIC,SAAiB;AAE5B,OAAO,SAASC,cAAcA,CAG5BC,MAAS,EACH;EACN,IAAIA,MAAM,CAACC,MAAM,KAAKP,sBAAsB,CAACQ,UAAU,EAAE;IACvDP,kBAAkB,CAACK,MAAM,CAACC,MAAM,CAAC,CAACD,MAAM,CAACG,OAAO,CAAC,GAAGH,MAAM;IAC1D;EACF;EACA;EACA,IACEL,kBAAkB,CAACD,sBAAsB,CAACQ,UAAU,CAAC,CAACF,MAAM,CAACG,OAAO,CAAC,KAC/DC,SAAS,EACf;IACAT,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B,EAAE,CAAC4E,aAAa,CAACnD,cAAc,EAAE2C,IAAI,CAACC,SAAS,CAACzD,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzE;AAEA,SAASqE,yBAAyBA,CAAA,EAAW;EAC3C,MAAMoI,cAAsB,GAAGxM,SAAS,CAACyM,QAAQ,CAAC,GAAG,CAAC,GAClDzM,SAAS,CAAC8D,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACtB9D,SAAS;EAEb,OAAO;AACT;AACA,iBAAiBwM,cAAc;AAC/B,CAAC;AACD;AAEA,OAAO,SAASE,kBAAkBA,CAACrM,OAAe,EAAU;EAC1D,OAAOA,OAAO,CAACsM,QAAQ,CAAC,GAAG,CAAC,GAAGtM,OAAO,GAAGL,SAAS,GAAGK,OAAO;AAC9D","ignoreList":[]}
|
|
@@ -92,10 +92,7 @@ export function defineValueType(valueTypeDef) {
|
|
|
92
92
|
displayName: displayName,
|
|
93
93
|
description: description ?? ""
|
|
94
94
|
},
|
|
95
|
-
status:
|
|
96
|
-
type: "active",
|
|
97
|
-
active: {}
|
|
98
|
-
},
|
|
95
|
+
status: convertUserValueTypeStatusToValueTypeStatus(valueTypeDef.status),
|
|
99
96
|
version: version,
|
|
100
97
|
baseType: baseType,
|
|
101
98
|
constraints: constraints,
|
|
@@ -105,4 +102,20 @@ export function defineValueType(valueTypeDef) {
|
|
|
105
102
|
updateOntology(vt);
|
|
106
103
|
return vt;
|
|
107
104
|
}
|
|
105
|
+
export function convertUserValueTypeStatusToValueTypeStatus(status) {
|
|
106
|
+
if (typeof status === "object" && status.type === "deprecated") {
|
|
107
|
+
return {
|
|
108
|
+
type: "deprecated",
|
|
109
|
+
deprecated: {
|
|
110
|
+
message: status.message,
|
|
111
|
+
deadline: status.deadline,
|
|
112
|
+
replacedBy: status.replacedBy
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
type: "active",
|
|
118
|
+
active: {}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
108
121
|
//# sourceMappingURL=defineValueType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineValueType.js","names":["invariant","OntologyEntityTypeEnum","namespace","updateOntology","convertValueTypeTypeToBaseType","valueType","type","array","elementType","structV2","fields","map","field","identifier","baseType","keyType","optional","wrappedType","Error","defineValueType","valueTypeDef","apiName","displayName","description","version","test","process","env","NODE_ENV","typeName","constraints","constraint","output","failureMessage","vt","packageNamespace","substring","length","displayMetadata","status","
|
|
1
|
+
{"version":3,"file":"defineValueType.js","names":["invariant","OntologyEntityTypeEnum","namespace","updateOntology","convertValueTypeTypeToBaseType","valueType","type","array","elementType","structV2","fields","map","field","identifier","baseType","keyType","optional","wrappedType","Error","defineValueType","valueTypeDef","apiName","displayName","description","version","test","process","env","NODE_ENV","typeName","constraints","constraint","output","failureMessage","vt","packageNamespace","substring","length","displayMetadata","status","convertUserValueTypeStatusToValueTypeStatus","exampleValues","__type","VALUE_TYPE","deprecated","message","deadline","replacedBy","active"],"sources":["defineValueType.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n BaseType,\n DataConstraint,\n DataConstraintWrapper,\n FailureMessage,\n ValueTypeDataConstraint,\n ValueTypeRid,\n ValueTypeStatus,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport { namespace, updateOntology } from \"./defineOntology.js\";\nimport { type ValueTypeDefinitionVersion } from \"./values/ValueTypeDefinitionVersion.js\";\nimport { type ValueTypeType } from \"./values/ValueTypeType.js\";\n\ntype ZipBaseAndConstraint<Base, Constraint> = {\n [PropertyType in (BaseType[\"type\"] & DataConstraint[\"type\"])]: Base extends\n { type: PropertyType } ? {\n baseType: Omit<Base, \"type\">;\n constraints?: Constraint extends { type: PropertyType } ? {\n constraint: Omit<Constraint, \"type\">;\n failureMessage?: FailureMessage;\n }[]\n : undefined;\n }\n : never;\n};\n\ntype MappedZip = ZipBaseAndConstraint<BaseType, DataConstraint>;\n\ntype TypeNames = ValueTypeType[\"type\"];\n\ntype ValueTypeDefinitionBacking = {\n [Type in ValueTypeType[\"type\"] & DataConstraint[\"type\"]]: {\n baseType: { \"type\": Extract<ValueTypeType, { type: Type }>[\"value\"] } & {\n constraints: {\n constraint: Extract<\n DataConstraint,\n { type: Type }\n >[keyof Omit<Extract<DataConstraint, { type: Type }>, \"type\">];\n failureMessage?: FailureMessage;\n }[];\n };\n };\n};\n\ntype NewValueTypeDefinitionBacking = {\n [Type in ValueTypeType as Type[\"type\"]]: {\n type: Type[\"value\"];\n constraints?: Type[\"constraints\"];\n };\n};\ntype NewValueTypeDefinition =\n NewValueTypeDefinitionBacking[keyof NewValueTypeDefinitionBacking];\n\nfunction convertValueTypeTypeToBaseType(\n valueType: ValueTypeType[\"value\"],\n): BaseType {\n if (typeof valueType === \"string\") {\n }\n switch (true) {\n case (typeof valueType === \"object\" && valueType.type === \"array\"):\n return {\n type: \"array\",\n array: {\n elementType: convertValueTypeTypeToBaseType(valueType.elementType),\n },\n };\n case (typeof valueType === \"object\" && valueType.type === \"struct\"):\n return {\n type: \"structV2\",\n structV2: {\n fields: valueType.fields.map(field => ({\n identifier: field.identifier,\n baseType: convertValueTypeTypeToBaseType(field.baseType),\n })),\n },\n };\n case (typeof valueType === \"object\" && valueType.type === \"map\"):\n return {\n type: \"map\",\n map: {\n keyType: convertValueTypeTypeToBaseType(valueType.keyType),\n valueType: convertValueTypeTypeToBaseType(valueType.valueType),\n },\n };\n case (typeof valueType === \"object\" && valueType.type === \"optional\"):\n return {\n type: \"optional\",\n optional: {\n wrappedType: convertValueTypeTypeToBaseType(valueType.wrappedType),\n },\n };\n case (typeof valueType === \"string\"):\n return { type: valueType, [valueType]: {} } as any;\n default:\n throw new Error(\"Invalid ValueTypeType\");\n }\n}\n\nexport type ValueTypeDefinition = {\n apiName: string;\n displayName: string;\n description?: string;\n type: NewValueTypeDefinition;\n version: string;\n status?: UserValueTypeStatus;\n};\n\nexport type UserValueTypeStatus = \"active\" | {\n type: \"deprecated\";\n message: string;\n deadline: string;\n replacedBy?: ValueTypeRid;\n};\n\nexport function defineValueType(\n valueTypeDef: ValueTypeDefinition,\n): ValueTypeDefinitionVersion {\n const { apiName, displayName, description, type, version } = valueTypeDef;\n const semverValidation =\n /^((([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?)$/;\n invariant(semverValidation.test(version), \"Version is not a valid semver\");\n\n const typeName: TypeNames = typeof type.type === \"string\"\n ? type.type\n : type.type.type === \"struct\"\n ? \"structV2\"\n : type.type.type;\n // These suck but TS doesn't understand the relationship from the key of the base type to the type string\n const constraints = type.constraints\n ? type.constraints.map<ValueTypeDataConstraint>(constraint => {\n const output: any = {\n constraint: { type: typeName, [typeName]: constraint.constraint },\n failureMessage: constraint.failureMessage,\n };\n return { constraint: output as DataConstraintWrapper };\n })\n : [];\n\n const baseType: BaseType = convertValueTypeTypeToBaseType(type.type);\n\n const vt: ValueTypeDefinitionVersion = {\n apiName,\n packageNamespace: namespace.substring(0, namespace.length - 1),\n displayMetadata: {\n displayName: displayName,\n description: description ?? \"\",\n },\n status: convertUserValueTypeStatusToValueTypeStatus(valueTypeDef.status),\n version: version,\n baseType: baseType,\n constraints: constraints,\n exampleValues: [],\n __type: OntologyEntityTypeEnum.VALUE_TYPE,\n };\n updateOntology(vt);\n return vt;\n}\n\nexport function convertUserValueTypeStatusToValueTypeStatus(\n status: UserValueTypeStatus | undefined,\n): ValueTypeStatus {\n if (typeof status === \"object\" && status.type === \"deprecated\") {\n return {\n type: \"deprecated\",\n deprecated: {\n message: status.message,\n deadline: status.deadline,\n replacedBy: status.replacedBy,\n },\n };\n }\n return { type: \"active\", active: {} };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,SAAS,EAAEC,cAAc,QAAQ,qBAAqB;AA4C/D,SAASC,8BAA8BA,CACrCC,SAAiC,EACvB;EACV,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE,CACnC;EACA,QAAQ,IAAI;IACV,KAAM,OAAOA,SAAS,KAAK,QAAQ,IAAIA,SAAS,CAACC,IAAI,KAAK,OAAO;MAC/D,OAAO;QACLA,IAAI,EAAE,OAAO;QACbC,KAAK,EAAE;UACLC,WAAW,EAAEJ,8BAA8B,CAACC,SAAS,CAACG,WAAW;QACnE;MACF,CAAC;IACH,KAAM,OAAOH,SAAS,KAAK,QAAQ,IAAIA,SAAS,CAACC,IAAI,KAAK,QAAQ;MAChE,OAAO;QACLA,IAAI,EAAE,UAAU;QAChBG,QAAQ,EAAE;UACRC,MAAM,EAAEL,SAAS,CAACK,MAAM,CAACC,GAAG,CAACC,KAAK,KAAK;YACrCC,UAAU,EAAED,KAAK,CAACC,UAAU;YAC5BC,QAAQ,EAAEV,8BAA8B,CAACQ,KAAK,CAACE,QAAQ;UACzD,CAAC,CAAC;QACJ;MACF,CAAC;IACH,KAAM,OAAOT,SAAS,KAAK,QAAQ,IAAIA,SAAS,CAACC,IAAI,KAAK,KAAK;MAC7D,OAAO;QACLA,IAAI,EAAE,KAAK;QACXK,GAAG,EAAE;UAC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jEE,cAAc,EAAEF,UAAU,CAACE;IAC7B,CAAC;IACD,OAAO;MAAEF,UAAU,EAAEC;IAAgC,CAAC;EACxD,CAAC,CAAC,GACA,EAAE;EAEN,MAAMlB,QAAkB,GAAGV,8BAA8B,CAACE,IAAI,CAACA,IAAI,CAAC;EAEpE,MAAM4B,EAA8B,GAAG;IACrCb,OAAO;IACPc,gBAAgB,EAAEjC,SAAS,CAACkC,SAAS,CAAC,CAAC,EAAElC,SAAS,CAACmC,MAAM,GAAG,CAAC,CAAC;IAC9DC,eAAe,EAAE;MACfhB,WAAW,EAAEA,WAAW;MACxBC,WAAW,EAAEA,WAAW,IAAI;IAC9B,CAAC;IACDgB,MAAM,EAAEC,2CAA2C,CAACpB,YAAY,CAACmB,MAAM,CAAC;IACxEf,OAAO,EAAEA,OAAO;IAChBV,QAAQ,EAAEA,QAAQ;IAClBgB,WAAW,EAAEA,WAAW;IACxBW,aAAa,EAAE,EAAE;IACjBC,MAAM,EAAEzC,sBAAsB,CAAC0C;EACjC,CAAC;EACDxC,cAAc,CAAC+B,EAAE,CAAC;EAClB,OAAOA,EAAE;AACX;AAEA,OAAO,SAASM,2CAA2CA,CACzDD,MAAuC,EACtB;EACjB,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,CAACjC,IAAI,KAAK,YAAY,EAAE;IAC9D,OAAO;MACLA,IAAI,EAAE,YAAY;MAClBsC,UAAU,EAAE;QACVC,OAAO,EAAEN,MAAM,CAACM,OAAO;QACvBC,QAAQ,EAAEP,MAAM,CAACO,QAAQ;QACzBC,UAAU,EAAER,MAAM,CAACQ;MACrB;IACF,CAAC;EACH;EACA,OAAO;IAAEzC,IAAI,EAAE,QAAQ;IAAE0C,MAAM,EAAE,CAAC;EAAE,CAAC;AACvC","ignoreList":[]}
|
|
@@ -35,6 +35,11 @@ export function mapSimplifiedStatusToInterfaceTypeStatus(status) {
|
|
|
35
35
|
type: "experimental",
|
|
36
36
|
experimental: {}
|
|
37
37
|
};
|
|
38
|
+
case "example":
|
|
39
|
+
return {
|
|
40
|
+
type: "example",
|
|
41
|
+
example: {}
|
|
42
|
+
};
|
|
38
43
|
default:
|
|
39
44
|
throw new Error(`Invalid status type: ${status.type}`);
|
|
40
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapSimplifiedStatusToInterfaceTypeStatus.js","names":["mapSimplifiedStatusToInterfaceTypeStatus","status","type","deprecated","message","deadline","replacedBy","undefined","active","experimental","Error"],"sources":["mapSimplifiedStatusToInterfaceTypeStatus.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 { InterfaceTypeStatus } from \"@osdk/client.unstable\";\nimport type { SimplifiedInterfaceTypeStatus } from \"../defineInterface.js\";\n\nexport function mapSimplifiedStatusToInterfaceTypeStatus(\n status: SimplifiedInterfaceTypeStatus,\n): InterfaceTypeStatus {\n switch (status.type) {\n case \"deprecated\":\n return {\n type: \"deprecated\",\n deprecated: {\n message: status.message,\n deadline: status.deadline,\n replacedBy: undefined,\n },\n };\n case \"active\":\n return {\n type: \"active\",\n active: {},\n };\n case \"experimental\":\n return {\n type: \"experimental\",\n experimental: {},\n };\n default:\n throw new Error(`Invalid status type: ${(status as any).type}`);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,wCAAwCA,CACtDC,MAAqC,EAChB;EACrB,QAAQA,MAAM,CAACC,IAAI;IACjB,KAAK,YAAY;MACf,OAAO;QACLA,IAAI,EAAE,YAAY;QAClBC,UAAU,EAAE;UACVC,OAAO,EAAEH,MAAM,CAACG,OAAO;UACvBC,QAAQ,EAAEJ,MAAM,CAACI,QAAQ;UACzBC,UAAU,EAAEC;QACd;MACF,CAAC;IACH,KAAK,QAAQ;MACX,OAAO;QACLL,IAAI,EAAE,QAAQ;QACdM,MAAM,EAAE,CAAC;MACX,CAAC;IACH,KAAK,cAAc;MACjB,OAAO;QACLN,IAAI,EAAE,cAAc;QACpBO,YAAY,EAAE,CAAC;MACjB,CAAC;IACH;MACE,MAAM,IAAIC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"mapSimplifiedStatusToInterfaceTypeStatus.js","names":["mapSimplifiedStatusToInterfaceTypeStatus","status","type","deprecated","message","deadline","replacedBy","undefined","active","experimental","example","Error"],"sources":["mapSimplifiedStatusToInterfaceTypeStatus.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 { InterfaceTypeStatus } from \"@osdk/client.unstable\";\nimport type { SimplifiedInterfaceTypeStatus } from \"../defineInterface.js\";\n\nexport function mapSimplifiedStatusToInterfaceTypeStatus(\n status: SimplifiedInterfaceTypeStatus,\n): InterfaceTypeStatus {\n switch (status.type) {\n case \"deprecated\":\n return {\n type: \"deprecated\",\n deprecated: {\n message: status.message,\n deadline: status.deadline,\n replacedBy: undefined,\n },\n };\n case \"active\":\n return {\n type: \"active\",\n active: {},\n };\n case \"experimental\":\n return {\n type: \"experimental\",\n experimental: {},\n };\n case \"example\":\n return {\n type: \"example\",\n example: {},\n };\n default:\n throw new Error(`Invalid status type: ${(status as any).type}`);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,wCAAwCA,CACtDC,MAAqC,EAChB;EACrB,QAAQA,MAAM,CAACC,IAAI;IACjB,KAAK,YAAY;MACf,OAAO;QACLA,IAAI,EAAE,YAAY;QAClBC,UAAU,EAAE;UACVC,OAAO,EAAEH,MAAM,CAACG,OAAO;UACvBC,QAAQ,EAAEJ,MAAM,CAACI,QAAQ;UACzBC,UAAU,EAAEC;QACd;MACF,CAAC;IACH,KAAK,QAAQ;MACX,OAAO;QACLL,IAAI,EAAE,QAAQ;QACdM,MAAM,EAAE,CAAC;MACX,CAAC;IACH,KAAK,cAAc;MACjB,OAAO;QACLN,IAAI,EAAE,cAAc;QACpBO,YAAY,EAAE,CAAC;MACjB,CAAC;IACH,KAAK,SAAS;MACZ,OAAO;QACLP,IAAI,EAAE,SAAS;QACfQ,OAAO,EAAE,CAAC;MACZ,CAAC;IACH;MACE,MAAM,IAAIC,KAAK,CAAC,wBAAyBV,MAAM,CAASC,IAAI,EAAE,CAAC;EACnE;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkType.js","names":[],"sources":["LinkType.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 LinkTypeDisplayMetadata,\n
|
|
1
|
+
{"version":3,"file":"LinkType.js","names":[],"sources":["LinkType.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 LinkTypeDisplayMetadata,\n LinkTypeId,\n LinkTypeMetadata,\n Visibility,\n} from \"@osdk/client.unstable\";\nimport type { OptionalFields } from \"../../util/OptionalFields.js\";\nimport type { RequiredFields } from \"../../util/RequiredFields.js\";\nimport type { OntologyEntityBase } from \"../common/OntologyEntityBase.js\";\nimport type { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport type { ObjectTypeDefinition } from \"../object/ObjectTypeDefinition.js\";\n\nexport type LinkType =\n | (OntologyEntityBase & OneToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n })\n | (OntologyEntityBase & ManyToManyLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n })\n | (OntologyEntityBase & IntermediaryLinkTypeDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n });\n\nexport type LinkTypeDefinition =\n | Omit<\n OntologyEntityBase & OneToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >\n | Omit<\n OntologyEntityBase & ManyToManyLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >\n | Omit<\n OntologyEntityBase & IntermediaryLinkTypeUserDefinition & {\n __type: OntologyEntityTypeEnum.LINK_TYPE;\n },\n \"__type\"\n >;\n\nexport type ObjectTypePropertyApiName = string;\n\nexport interface OneToManyLinkTypeDefinition {\n apiName: string;\n one: OneToManyObjectLinkReference;\n toMany: OneToManyObjectLinkReference;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality: \"OneToMany\" | \"OneToOne\" | undefined;\n editsEnabled?: boolean;\n status?: UserLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface OneToManyObjectLinkReference {\n object: ObjectTypeDefinition | string;\n metadata: LinkTypeMetadata;\n}\n\nexport interface OneToManyLinkTypeUserDefinition {\n apiName: string;\n one: OneToManyObjectLinkReferenceUserDefinition;\n toMany: OneToManyObjectLinkReferenceUserDefinition;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n editsEnabled?: boolean;\n status?: UserLinkTypeStatus;\n cardinality?: \"OneToMany\" | \"OneToOne\" | undefined;\n}\n\nexport interface OneToManyObjectLinkReferenceUserDefinition {\n object: ObjectTypeDefinition | string;\n metadata: LinkTypeMetadataUserDefinition;\n}\n\nexport interface ManyToManyLinkTypeDefinition {\n apiName: string;\n many: ManyToManyObjectLinkReference;\n toMany: ManyToManyObjectLinkReference;\n editsEnabled?: boolean;\n status?: UserLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface ManyToManyObjectLinkReference {\n object: ObjectTypeDefinition | string;\n metadata: LinkTypeMetadata;\n}\n\nexport interface ManyToManyLinkTypeUserDefinition {\n apiName: string;\n many: ManyToManyObjectLinkReferenceUserDefinition;\n toMany: ManyToManyObjectLinkReferenceUserDefinition;\n editsEnabled?: boolean;\n status?: UserLinkTypeStatus;\n}\n\nexport interface ManyToManyObjectLinkReferenceUserDefinition {\n object: ObjectTypeDefinition | string;\n metadata: LinkTypeMetadataUserDefinition;\n}\n\nexport interface IntermediaryLinkTypeDefinition {\n apiName: string;\n many: IntermediaryObjectLinkReference;\n toMany: IntermediaryObjectLinkReference;\n intermediaryObjectType: ObjectTypeDefinition;\n editsEnabled?: boolean;\n status?: UserLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface IntermediaryObjectLinkReference {\n object: ObjectTypeDefinition | string;\n metadata: LinkTypeMetadata;\n linkToIntermediary: LinkType;\n}\n\nexport interface IntermediaryLinkTypeUserDefinition {\n apiName: string;\n many: IntermediaryObjectLinkReferenceUserDefinition;\n toMany: IntermediaryObjectLinkReferenceUserDefinition;\n intermediaryObjectType: ObjectTypeDefinition | string;\n editsEnabled?: boolean;\n status?: UserLinkTypeStatus;\n}\n\nexport interface IntermediaryObjectLinkReferenceUserDefinition {\n object: ObjectTypeDefinition | string;\n metadata: LinkTypeMetadataUserDefinition;\n linkToIntermediary: LinkType;\n}\n\nexport interface LinkTypeMetadataUserDefinition {\n apiName: string;\n displayName?: string;\n pluralDisplayName?: string;\n visibility?: Visibility;\n groupDisplayName?: string;\n}\n\nexport type LinkSideMetadata = OptionalFields<\n RequiredFields<\n Omit<LinkTypeMetadata, \"displayMetadata\"> & LinkTypeDisplayMetadata,\n \"apiName\"\n >,\n \"visibility\" | \"typeClasses\"\n>;\n\nexport type UserLinkTypeStatus =\n | \"active\"\n | \"experimental\"\n | \"example\"\n | {\n type: \"deprecated\";\n message: string;\n deadline: string;\n replacedBy?: LinkTypeId;\n };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectTypeStatus.js","names":[],"sources":["ObjectTypeStatus.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\nexport type ObjectTypeStatus =\n | \"active\"\n | \"experimental\"\n | {\n type: \"deprecated\";\n message: string;\n deadline: string;\n };\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObjectTypeStatus.js","names":[],"sources":["ObjectTypeStatus.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\nexport type ObjectTypeStatus =\n | \"active\"\n | \"experimental\"\n | \"example\"\n | {\n type: \"deprecated\";\n message: string;\n deadline: string;\n };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1173,5 +1173,17 @@ describe("Interfaces", () => {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
});
|
|
1175
1175
|
});
|
|
1176
|
+
it("sets interface status as example from opts", () => {
|
|
1177
|
+
const result = defineInterface({
|
|
1178
|
+
apiName: "Foo",
|
|
1179
|
+
status: {
|
|
1180
|
+
type: "example"
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1183
|
+
expect(result.status).toEqual({
|
|
1184
|
+
type: "example",
|
|
1185
|
+
example: {}
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1176
1188
|
});
|
|
1177
1189
|
//# sourceMappingURL=interfaces.test.js.map
|