@osdk/maker 0.10.0-beta.13 → 0.10.0-beta.14

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.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ApiNameValueTypeReference,\n BaseType,\n DataConstraint,\n ExampleValue,\n FailureMessage,\n ImportedTypes,\n InterfaceTypeStatus,\n InterfaceTypeStatus_active,\n InterfaceTypeStatus_deprecated,\n InterfaceTypeStatus_experimental,\n LinkTypeDisplayMetadata,\n LinkTypeMetadata,\n OntologyIrInterfaceType,\n OntologyIrLinkTypeStatus,\n OntologyIrObjectType,\n OntologyIrPropertyType,\n SharedPropertyTypeGothamMapping,\n StructFieldType,\n ValueTypeApiName,\n ValueTypeDataConstraint,\n ValueTypeDisplayMetadata,\n ValueTypeStatus,\n ValueTypeVersion,\n Visibility,\n} from \"@osdk/client.unstable\";\n\nimport type { OntologyFullMetadata } from \"@osdk/foundry.ontologies\";\nimport type { BlueprintIcon } from \"./iconNames.js\";\n\nexport interface Ontology extends\n Omit<\n OntologyFullMetadata,\n \"ontology\" | \"sharedPropertyTypes\" | \"interfaceTypes\" | \"objectTypes\"\n >\n{\n interfaceTypes: Record<string, InterfaceType>;\n sharedPropertyTypes: Record<string, SharedPropertyType>;\n objectTypes: Record<string, ObjectType>;\n valueTypes: Record<string, ValueTypeDefinitionVersion[]>;\n linkTypes: Record<string, LinkTypeDefinition>;\n importedTypes: ImportedTypes;\n}\nexport type {\n InterfaceTypeStatus,\n InterfaceTypeStatus_active,\n InterfaceTypeStatus_deprecated,\n InterfaceTypeStatus_experimental,\n};\n\nexport type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;\nexport type OptionalFields<T, K extends keyof T> =\n & Pick<Partial<T>, K>\n & Omit<T, K>;\n\nexport interface ObjectTypeInner extends\n Omit<\n OntologyIrObjectType,\n | \"titlePropertyTypeRid\"\n | \"propertyTypes\"\n | \"allImplementsInterfaces\"\n | \"implementsInterfaces2\"\n | \"displayMetadata\"\n >\n{\n properties: Array<ObjectPropertyType>;\n titlePropertyApiName: string;\n implementsInterfaces: Array<InterfaceImplementation>;\n description: string | undefined;\n icon: { locator: BlueprintIcon; color: string } | undefined;\n displayName: string;\n pluralDisplayName: string;\n visibility: Visibility;\n editsEnabled: boolean;\n}\n\nexport type InterfaceImplementation = {\n implements: InterfaceType;\n propertyMapping: { interfaceProperty: string; mapsTo: string }[];\n};\n\nexport type ObjectType = RequiredFields<\n Partial<ObjectTypeInner>,\n | \"apiName\"\n | \"primaryKeys\"\n | \"displayName\"\n | \"pluralDisplayName\"\n | \"titlePropertyApiName\"\n>;\n\nexport interface ObjectPropertyTypeInner extends\n Omit<\n OntologyIrPropertyType,\n | \"sharedPropertyTypeApiName\"\n | \"type\"\n | \"inlineAction\"\n | \"sharedPropertyTypeRid\"\n | \"valueType\"\n | \"ruleSetBinding\"\n | \"displayMetadata\"\n >\n{\n type: PropertyTypeType;\n array?: boolean;\n valueType: string | ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n}\n\nexport type ObjectPropertyType = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"apiName\" | \"type\" | \"displayName\"\n>;\n\nexport interface InterfacePropertyType {\n sharedPropertyType: SharedPropertyType;\n required: boolean;\n}\nexport interface InterfaceType extends\n Omit<\n OntologyIrInterfaceType,\n // we want our simplified representation\n | \"properties\"\n // these things don't need to exist as the system works fine without them (I'm told)\n | \"allProperties\"\n | \"allLinks\"\n | \"allExtendsInterfaces\"\n | \"propertiesV2\"\n | \"allPropertiesV2\"\n >\n{\n propertiesV2: Record<string, InterfacePropertyType>;\n status: InterfaceTypeStatus;\n}\n\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: ApiNameValueTypeReference;\n typeClasses?: TypeClass[];\n}\n\ntype TypeClass = { kind: string; name: string };\n\nexport interface SharedPropertyType extends PropertyType {\n apiName: string;\n nonNameSpacedApiName: string;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n}\n\nexport type PropertyTypeType =\n | PropertyTypeTypesWithoutStruct\n | {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, MarkingPropertyType>;\n };\n };\n\nexport type PropertyTypeTypesWithoutStruct =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"geopoint\"\n | \"geoshape\"\n | \"integer\"\n | \"long\"\n | MarkingPropertyType\n | \"short\"\n | \"string\"\n | \"timestamp\"\n | \"mediaReference\";\n\ntype MarkingPropertyType = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n};\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends\n Optional<\n Omit<\n StructFieldType,\n \"fieldType\" | \"structFieldRid\" | \"apiName\"\n >,\n \"typeClasses\" | \"aliases\"\n >\n{\n fieldType: PropertyTypeTypesWithoutStruct;\n}\n\nexport type ObjectTypePropertyApiName = string;\nexport type LinkTypeId = string;\n\nexport type LinkTypeDefinition =\n | OneToManyLinkTypeDefinition\n | ManyToManyLinkTypeDefinition;\n\nexport interface OneToManyLinkTypeDefinition {\n id: LinkTypeId;\n one: OneToManyObjectLinkReference;\n toMany: OneToManyObjectLinkReference;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality: \"OneToMany\" | \"OneToOne\" | undefined;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface OneToManyObjectLinkReference {\n object: ObjectType;\n metadata: LinkTypeMetadata;\n}\n\nexport interface ManyToManyLinkTypeDefinition {\n id: LinkTypeId;\n many: ManyToManyObjectLinkReference;\n toMany: ManyToManyObjectLinkReference;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface ManyToManyObjectLinkReference {\n object: ObjectType;\n metadata: LinkTypeMetadata;\n}\n\nexport type LinkSideMetadata = OptionalFields<\n RequiredFields<\n Omit<LinkTypeMetadata, \"displayMetadata\"> & LinkTypeDisplayMetadata,\n \"apiName\"\n >,\n \"visibility\" | \"typeClasses\"\n>;\nexport interface ValueTypeType_array {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"array\" }>[\"array\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"array\";\n value: {\n type: \"array\";\n elementType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_boolean {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"boolean\" }>[\"boolean\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"boolean\";\n value: \"boolean\";\n}\n\nexport interface ValueTypeType_binary {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"binary\" }>[\"binary\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"binary\";\n value: \"binary\";\n}\n\nexport interface ValueTypeType_byte {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"byte\" }>[\"byte\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"byte\";\n value: \"byte\";\n}\n\nexport interface ValueTypeType_date {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"date\" }>[\"date\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"date\";\n value: \"date\";\n}\n\nexport interface ValueTypeType_decimal {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"decimal\" }>[\"decimal\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"decimal\";\n value: \"decimal\";\n}\n\nexport interface ValueTypeType_double {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"double\" }>[\"double\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"double\";\n value: \"double\";\n}\n\nexport interface ValueTypeType_float {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"float\" }>[\"float\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"float\";\n value: \"float\";\n}\n\nexport interface ValueTypeType_integer {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"integer\" }>[\"integer\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"integer\";\n value: \"integer\";\n}\n\nexport interface ValueTypeType_long {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"long\" }>[\"long\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"long\";\n value: \"long\";\n}\n\nexport interface ValueTypeType_map {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"map\" }>[\"map\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"map\";\n value: {\n type: \"map\";\n keyType: ValueTypeType[\"value\"];\n valueType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_optional {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"optional\" }>[\"optional\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"optional\";\n value: {\n type: \"optional\";\n wrappedType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_short {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"short\" }>[\"short\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"short\";\n value: \"short\";\n}\n\nexport interface ValueTypeType_string {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"string\" }>[\"string\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"string\";\n value: \"string\";\n}\n\nexport interface ValueTypeType_structV2 {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"structV2\" }>[\"structV2\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"structV2\";\n value: {\n type: \"struct\";\n fields: Array<{\n identifier: string;\n baseType: ValueTypeType[\"value\"];\n }>;\n };\n}\nexport interface ValueTypeType_timestamp {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"timestamp\" }>[\"timestamp\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"timestamp\";\n value: \"timestamp\";\n}\n\nexport type ValueTypeType =\n | ValueTypeType_array\n | ValueTypeType_boolean\n | ValueTypeType_binary\n | ValueTypeType_byte\n | ValueTypeType_date\n | ValueTypeType_decimal\n | ValueTypeType_double\n | ValueTypeType_float\n | ValueTypeType_integer\n | ValueTypeType_long\n | ValueTypeType_map\n | ValueTypeType_optional\n | ValueTypeType_short\n | ValueTypeType_string\n | ValueTypeType_structV2\n | ValueTypeType_timestamp;\n\nexport type ValueTypeDefinitionVersion = {\n apiName: ValueTypeApiName;\n displayMetadata: ValueTypeDisplayMetadata;\n status: ValueTypeStatus;\n version: ValueTypeVersion;\n baseType: BaseType;\n constraints: ValueTypeDataConstraint[];\n exampleValues: ExampleValue[];\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ApiNameValueTypeReference,\n BaseType,\n DataConstraint,\n ExampleValue,\n FailureMessage,\n ImportedTypes,\n InterfaceTypeStatus,\n InterfaceTypeStatus_active,\n InterfaceTypeStatus_deprecated,\n InterfaceTypeStatus_experimental,\n LinkTypeDisplayMetadata,\n LinkTypeMetadata,\n OntologyIrInterfaceType,\n OntologyIrLinkTypeStatus,\n OntologyIrObjectType,\n OntologyIrPropertyType,\n SharedPropertyTypeGothamMapping,\n StructFieldType,\n ValueTypeApiName,\n ValueTypeDataConstraint,\n ValueTypeDisplayMetadata,\n ValueTypeStatus,\n ValueTypeVersion,\n Visibility,\n} from \"@osdk/client.unstable\";\n\nimport type { OntologyFullMetadata } from \"@osdk/foundry.ontologies\";\nimport type { BlueprintIcon } from \"./iconNames.js\";\n\nexport interface Ontology extends\n Omit<\n OntologyFullMetadata,\n \"ontology\" | \"sharedPropertyTypes\" | \"interfaceTypes\" | \"objectTypes\"\n >\n{\n interfaceTypes: Record<string, InterfaceType>;\n sharedPropertyTypes: Record<string, SharedPropertyType>;\n objectTypes: Record<string, ObjectType>;\n valueTypes: Record<string, ValueTypeDefinitionVersion[]>;\n linkTypes: Record<string, LinkTypeDefinition>;\n importedTypes: ImportedTypes;\n}\nexport type {\n InterfaceTypeStatus,\n InterfaceTypeStatus_active,\n InterfaceTypeStatus_deprecated,\n InterfaceTypeStatus_experimental,\n};\n\nexport type RequiredFields<T, K extends keyof T> = T & Required<Pick<T, K>>;\nexport type OptionalFields<T, K extends keyof T> =\n & Pick<Partial<T>, K>\n & Omit<T, K>;\n\nexport interface ObjectTypeInner extends\n Omit<\n OntologyIrObjectType,\n | \"titlePropertyTypeRid\"\n | \"propertyTypes\"\n | \"allImplementsInterfaces\"\n | \"implementsInterfaces2\"\n | \"displayMetadata\"\n >\n{\n properties: Array<ObjectPropertyType>;\n titlePropertyApiName: string;\n implementsInterfaces: Array<InterfaceImplementation>;\n description: string | undefined;\n icon: { locator: BlueprintIcon; color: string } | undefined;\n displayName: string;\n pluralDisplayName: string;\n visibility: Visibility;\n editsEnabled: boolean;\n}\n\nexport type InterfaceImplementation = {\n implements: InterfaceType;\n propertyMapping: { interfaceProperty: string; mapsTo: string }[];\n};\n\nexport type ObjectType =\n & RequiredFields<\n Partial<ObjectTypeInner>,\n | \"apiName\"\n | \"primaryKeys\"\n | \"displayName\"\n | \"pluralDisplayName\"\n | \"titlePropertyApiName\"\n >\n & {\n datasource?: ObjectTypeDatasourceDefinition;\n };\n\nexport interface ObjectPropertyTypeInner extends\n Omit<\n OntologyIrPropertyType,\n | \"sharedPropertyTypeApiName\"\n | \"type\"\n | \"inlineAction\"\n | \"sharedPropertyTypeRid\"\n | \"valueType\"\n | \"ruleSetBinding\"\n | \"displayMetadata\"\n >\n{\n type: PropertyTypeType;\n array?: boolean;\n valueType: string | ValueTypeDefinitionVersion;\n sharedPropertyType: SharedPropertyType;\n description: string | undefined;\n displayName: string;\n visibility: Visibility;\n}\n\nexport type ObjectPropertyType = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"apiName\" | \"type\" | \"displayName\"\n>;\n\nexport interface InterfacePropertyType {\n sharedPropertyType: SharedPropertyType;\n required: boolean;\n}\nexport interface InterfaceType extends\n Omit<\n OntologyIrInterfaceType,\n // we want our simplified representation\n | \"properties\"\n // these things don't need to exist as the system works fine without them (I'm told)\n | \"allProperties\"\n | \"allLinks\"\n | \"allExtendsInterfaces\"\n | \"propertiesV2\"\n | \"allPropertiesV2\"\n >\n{\n propertiesV2: Record<string, InterfacePropertyType>;\n status: InterfaceTypeStatus;\n}\n\nexport interface PropertyType {\n type: PropertyTypeType;\n array?: boolean;\n description?: string;\n displayName?: string;\n valueType?: ApiNameValueTypeReference;\n typeClasses?: TypeClass[];\n}\n\ntype TypeClass = { kind: string; name: string };\n\nexport interface SharedPropertyType extends PropertyType {\n apiName: string;\n nonNameSpacedApiName: string;\n gothamMapping?: SharedPropertyTypeGothamMapping;\n}\n\nexport type PropertyTypeType =\n | PropertyTypeTypesWithoutStruct\n | {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<PropertyTypeTypesWithoutStruct, MarkingPropertyType>;\n };\n };\n\nexport type PropertyTypeTypesWithoutStruct =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"geopoint\"\n | \"geoshape\"\n | \"integer\"\n | \"long\"\n | MarkingPropertyType\n | \"short\"\n | \"string\"\n | \"timestamp\"\n | \"mediaReference\";\n\ntype MarkingPropertyType = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n};\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends\n Optional<\n Omit<\n StructFieldType,\n \"fieldType\" | \"structFieldRid\" | \"apiName\"\n >,\n \"typeClasses\" | \"aliases\"\n >\n{\n fieldType: PropertyTypeTypesWithoutStruct;\n}\n\nexport type ObjectTypePropertyApiName = string;\nexport type LinkTypeId = string;\n\nexport type LinkTypeDefinition =\n | OneToManyLinkTypeDefinition\n | ManyToManyLinkTypeDefinition;\n\nexport interface OneToManyLinkTypeDefinition {\n id: LinkTypeId;\n one: OneToManyObjectLinkReference;\n toMany: OneToManyObjectLinkReference;\n manyForeignKeyProperty: ObjectTypePropertyApiName;\n cardinality: \"OneToMany\" | \"OneToOne\" | undefined;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface OneToManyObjectLinkReference {\n object: ObjectType;\n metadata: LinkTypeMetadata;\n}\n\nexport interface ManyToManyLinkTypeDefinition {\n id: LinkTypeId;\n many: ManyToManyObjectLinkReference;\n toMany: ManyToManyObjectLinkReference;\n editsEnabled?: boolean;\n status?: OntologyIrLinkTypeStatus;\n redacted?: boolean;\n}\n\nexport interface ManyToManyObjectLinkReference {\n object: ObjectType;\n metadata: LinkTypeMetadata;\n}\n\nexport type LinkSideMetadata = OptionalFields<\n RequiredFields<\n Omit<LinkTypeMetadata, \"displayMetadata\"> & LinkTypeDisplayMetadata,\n \"apiName\"\n >,\n \"visibility\" | \"typeClasses\"\n>;\nexport interface ValueTypeType_array {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"array\" }>[\"array\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"array\";\n value: {\n type: \"array\";\n elementType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_boolean {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"boolean\" }>[\"boolean\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"boolean\";\n value: \"boolean\";\n}\n\nexport interface ValueTypeType_binary {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"binary\" }>[\"binary\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"binary\";\n value: \"binary\";\n}\n\nexport interface ValueTypeType_byte {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"byte\" }>[\"byte\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"byte\";\n value: \"byte\";\n}\n\nexport interface ValueTypeType_date {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"date\" }>[\"date\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"date\";\n value: \"date\";\n}\n\nexport interface ValueTypeType_decimal {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"decimal\" }>[\"decimal\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"decimal\";\n value: \"decimal\";\n}\n\nexport interface ValueTypeType_double {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"double\" }>[\"double\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"double\";\n value: \"double\";\n}\n\nexport interface ValueTypeType_float {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"float\" }>[\"float\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"float\";\n value: \"float\";\n}\n\nexport interface ValueTypeType_integer {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"integer\" }>[\"integer\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"integer\";\n value: \"integer\";\n}\n\nexport interface ValueTypeType_long {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"long\" }>[\"long\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"long\";\n value: \"long\";\n}\n\nexport interface ValueTypeType_map {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"map\" }>[\"map\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"map\";\n value: {\n type: \"map\";\n keyType: ValueTypeType[\"value\"];\n valueType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_optional {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"optional\" }>[\"optional\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"optional\";\n value: {\n type: \"optional\";\n wrappedType: ValueTypeType[\"value\"];\n };\n}\n\nexport interface ValueTypeType_short {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"short\" }>[\"short\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"short\";\n value: \"short\";\n}\n\nexport interface ValueTypeType_string {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"string\" }>[\"string\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"string\";\n value: \"string\";\n}\n\nexport interface ValueTypeType_structV2 {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"structV2\" }>[\"structV2\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"structV2\";\n value: {\n type: \"struct\";\n fields: Array<{\n identifier: string;\n baseType: ValueTypeType[\"value\"];\n }>;\n };\n}\nexport interface ValueTypeType_timestamp {\n constraints: {\n constraint: Extract<DataConstraint, { type: \"timestamp\" }>[\"timestamp\"];\n failureMessage?: FailureMessage;\n }[];\n type: \"timestamp\";\n value: \"timestamp\";\n}\n\nexport type ValueTypeType =\n | ValueTypeType_array\n | ValueTypeType_boolean\n | ValueTypeType_binary\n | ValueTypeType_byte\n | ValueTypeType_date\n | ValueTypeType_decimal\n | ValueTypeType_double\n | ValueTypeType_float\n | ValueTypeType_integer\n | ValueTypeType_long\n | ValueTypeType_map\n | ValueTypeType_optional\n | ValueTypeType_short\n | ValueTypeType_string\n | ValueTypeType_structV2\n | ValueTypeType_timestamp;\n\nexport type ValueTypeDefinitionVersion = {\n apiName: ValueTypeApiName;\n displayMetadata: ValueTypeDisplayMetadata;\n status: ValueTypeStatus;\n version: ValueTypeVersion;\n baseType: BaseType;\n constraints: ValueTypeDataConstraint[];\n exampleValues: ExampleValue[];\n};\n\nexport interface ObjectTypeDatasourceDefinition_dataset {\n type: \"dataset\";\n}\n\nexport interface ObjectTypeDatasourceDefinition_stream {\n type: \"stream\";\n // Retention period must be in ISO 8601 duration format\n retentionPeriod?: string;\n}\n\nexport type ObjectTypeDatasourceDefinition =\n | ObjectTypeDatasourceDefinition_stream\n | ObjectTypeDatasourceDefinition_dataset;\n"],"mappings":"","ignoreList":[]}
@@ -26,7 +26,7 @@ import { defineOntology } from "../api/defineOntology.js";
26
26
  import { defineSharedPropertyType } from "../api/defineSpt.js";
27
27
  const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
28
28
  export default async function main(args = process.argv) {
29
- const commandLineOpts = await yargs(hideBin(args)).version("0.10.0-beta.13" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
29
+ const commandLineOpts = await yargs(hideBin(args)).version("0.10.0-beta.14" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
30
30
  input: {
31
31
  alias: "i",
32
32
  describe: "Input file",
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var consola = require('consola');
6
6
  var fs = require('fs/promises');
7
7
  var path = require('path');
8
- var invariant2 = require('tiny-invariant');
8
+ var invariant3 = require('tiny-invariant');
9
9
  var yargs = require('yargs');
10
10
  var helpers = require('yargs/helpers');
11
11
 
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
31
31
 
32
32
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
33
33
  var path__namespace = /*#__PURE__*/_interopNamespace(path);
34
- var invariant2__default = /*#__PURE__*/_interopDefault(invariant2);
34
+ var invariant3__default = /*#__PURE__*/_interopDefault(invariant3);
35
35
  var yargs__default = /*#__PURE__*/_interopDefault(yargs);
36
36
 
37
37
  // src/cli/main.ts
@@ -108,22 +108,9 @@ function convertToWireOntologyIr(ontology) {
108
108
  };
109
109
  }
110
110
  function convertObject(objectType) {
111
- const propertyDatasource = {};
112
- (objectType.properties ?? []).forEach((property) => {
113
- propertyDatasource[property.apiName] = {
114
- type: "column",
115
- column: property.apiName
116
- };
117
- });
118
111
  const datasource = {
119
112
  rid: "ri.ontology.main.datasource.".concat(objectType.apiName),
120
- datasource: {
121
- type: "datasetV2",
122
- datasetV2: {
123
- datasetRid: objectType.apiName,
124
- propertyMapping: propertyDatasource
125
- }
126
- },
113
+ datasource: convertDatasourceDefinition(objectType),
127
114
  editsConfiguration: {
128
115
  onlyAllowPrivilegedEdits: false
129
116
  },
@@ -169,6 +156,43 @@ function convertObject(objectType) {
169
156
  }
170
157
  };
171
158
  }
159
+ function convertDatasourceDefinition(objectType) {
160
+ switch (objectType.datasource?.type) {
161
+ case "stream":
162
+ const window = objectType.datasource.retentionPeriod;
163
+ const retentionPolicy = window ? {
164
+ type: "time",
165
+ time: {
166
+ window
167
+ }
168
+ } : {
169
+ type: "none",
170
+ none: {}
171
+ };
172
+ const propertyMapping = Object.fromEntries((objectType.properties ?? []).map((prop) => [prop.apiName, prop.apiName]));
173
+ return {
174
+ type: "streamV2",
175
+ streamV2: {
176
+ streamLocator: objectType.apiName,
177
+ propertyMapping,
178
+ retentionPolicy,
179
+ propertySecurityGroups: undefined
180
+ }
181
+ };
182
+ case "dataset":
183
+ default:
184
+ return {
185
+ type: "datasetV2",
186
+ datasetV2: {
187
+ datasetRid: objectType.apiName,
188
+ propertyMapping: Object.fromEntries((objectType.properties ?? []).map((prop) => [prop.apiName, {
189
+ type: "column",
190
+ column: prop.apiName
191
+ }]))
192
+ }
193
+ };
194
+ }
195
+ }
172
196
  function convertProperty(property) {
173
197
  const output = {
174
198
  apiName: property.apiName,
@@ -453,7 +477,7 @@ var defaultTypeClasses = [{
453
477
  }];
454
478
  function defineSharedPropertyType(opts) {
455
479
  const apiName = namespace + opts.apiName;
456
- !(ontologyDefinition.sharedPropertyTypes[apiName] === undefined) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Shared property type ${apiName} already exists`) : invariant2__default.default(false) : undefined;
480
+ !(ontologyDefinition.sharedPropertyTypes[apiName] === undefined) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Shared property type ${apiName} already exists`) : invariant3__default.default(false) : undefined;
457
481
  return ontologyDefinition.sharedPropertyTypes[apiName] = {
458
482
  ...opts,
459
483
  apiName,
@@ -467,7 +491,7 @@ function defineSharedPropertyType(opts) {
467
491
  // src/api/defineInterface.ts
468
492
  function defineInterface(opts) {
469
493
  const apiName = namespace + opts.apiName;
470
- !(ontologyDefinition.interfaceTypes[apiName] === undefined) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Interface ${apiName} already exists`) : invariant2__default.default(false) : undefined;
494
+ !(ontologyDefinition.interfaceTypes[apiName] === undefined) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Interface ${apiName} already exists`) : invariant3__default.default(false) : undefined;
471
495
  const properties = Object.fromEntries(Object.entries(opts.properties ?? {}).map(([apiName2, type]) => {
472
496
  if (typeof type === "object" && "propertyDefinition" in type) {
473
497
  return [apiName2, {
@@ -495,7 +519,7 @@ function defineInterface(opts) {
495
519
  const status = mapSimplifiedStatusToInterfaceTypeStatus(opts.status ?? {
496
520
  type: "active"
497
521
  });
498
- !(status.type !== "deprecated" || status.deprecated.message && status.deprecated.deadline) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Deprecated status must include message and deadline properties.`) : invariant2__default.default(false) : undefined;
522
+ !(status.type !== "deprecated" || status.deprecated.message && status.deprecated.deadline) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Deprecated status must include message and deadline properties.`) : invariant3__default.default(false) : undefined;
499
523
  const a = {
500
524
  apiName,
501
525
  displayMetadata: {
@@ -546,7 +570,7 @@ function mapSimplifiedStatusToInterfaceTypeStatus(status) {
546
570
  }
547
571
  function unifyBasePropertyDefinition(apiName, type) {
548
572
  if (typeof type === "string" || typeof type === "object" && !("apiName" in type)) {
549
- !isPropertyTypeType(type) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Invalid data type ${JSON.stringify(type)} for property ${apiName} on InterfaceType ${apiName}`) : invariant2__default.default(false) : undefined;
573
+ !isPropertyTypeType(type) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Invalid data type ${JSON.stringify(type)} for property ${apiName} on InterfaceType ${apiName}`) : invariant3__default.default(false) : undefined;
550
574
  const spt = defineSharedPropertyType({
551
575
  apiName,
552
576
  displayName: apiName,
@@ -556,23 +580,26 @@ function unifyBasePropertyDefinition(apiName, type) {
556
580
  return spt;
557
581
  } else {
558
582
  const unNamespacedTypeApiName = type.apiName.slice(type.apiName.lastIndexOf(".") + 1);
559
- !(namespace + apiName === type.apiName || apiName === unNamespacedTypeApiName) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `property key and it's apiName must be identical. ${JSON.stringify({
583
+ !(namespace + apiName === type.apiName || apiName === unNamespacedTypeApiName) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `property key and it's apiName must be identical. ${JSON.stringify({
560
584
  key: apiName,
561
585
  apiName: type.apiName
562
- })}`) : invariant2__default.default(false) : undefined;
586
+ })}`) : invariant3__default.default(false) : undefined;
563
587
  return type;
564
588
  }
565
589
  }
590
+ var ISO_8601_DURATION = /^P(?!$)(?:(?:((?:\d+Y)|(?:\d+(?:\.|,)\d+Y$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+D)|(?:\d+(?:\.|,)\d+D$))?(T((?:\d+H)|(?:\d+(?:\.|,)\d+H$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+S)|(?:\d+(?:\.|,)\d+S$))?)?)|(?:\d+(?:(?:\.|,)\d+)?W))$/;
566
591
  function defineObject(objectDef) {
567
592
  const apiName = namespace + objectDef.apiName;
568
593
  const propertyApiNames = (objectDef.properties ?? []).map((val) => val.apiName);
569
594
  if (ontologyDefinition.objectTypes[apiName] !== undefined) {
570
595
  throw new Error(`Object type with apiName ${objectDef.apiName} is already defined`);
571
596
  }
572
- !propertyApiNames.includes(objectDef.titlePropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`) : invariant2__default.default(false) : undefined;
573
- !(objectDef.primaryKeys.length !== 0) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `${objectDef.apiName} does not have any primary keys, objects must have at least one primary key`) : invariant2__default.default(false) : undefined;
597
+ !propertyApiNames.includes(objectDef.titlePropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`) : invariant3__default.default(false) : undefined;
598
+ !(objectDef.primaryKeys.length !== 0) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `${objectDef.apiName} does not have any primary keys, objects must have at least one primary key`) : invariant3__default.default(false) : undefined;
574
599
  const nonExistentPrimaryKeys = objectDef.primaryKeys.filter((primaryKey) => !objectDef.properties?.map((val) => val.apiName).includes(primaryKey));
575
- !(nonExistentPrimaryKeys.length === 0) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Primary key properties ${nonExistentPrimaryKeys} do not exist on object ${objectDef.apiName}`) : invariant2__default.default(false) : undefined;
600
+ !(nonExistentPrimaryKeys.length === 0) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Primary key properties ${nonExistentPrimaryKeys} do not exist on object ${objectDef.apiName}`) : invariant3__default.default(false) : undefined;
601
+ const retentionPeriod = objectDef.datasource?.retentionPeriod;
602
+ !(retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod)) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Retention period "${retentionPeriod}" on object "${objectDef.apiName}" is not a valid ISO 8601 duration string`) : invariant3__default.default(false) : undefined;
576
603
  objectDef.implementsInterfaces?.forEach((interfaceImpl) => {
577
604
  const nonExistentInterfaceProperties = interfaceImpl.propertyMapping.map((val) => val.interfaceProperty).filter((interfaceProperty) => interfaceImpl.implements.propertiesV2[interfaceProperty] === undefined).map((interfaceProp) => ({
578
605
  type: "invalid",
@@ -591,7 +618,7 @@ function defineObject(objectDef) {
591
618
  const baseValidations = Object.entries(interfaceImpl.implements.propertiesV2).map(validateProperty);
592
619
  const extendsValidations = interfaceImpl.implements.extendsInterfaces.flatMap((interfaceApiName) => Object.entries(ontologyDefinition.interfaceTypes[interfaceApiName].propertiesV2).map(validateProperty));
593
620
  const allFailedValidations = baseValidations.concat(extendsValidations, nonExistentInterfaceProperties).filter((val) => val.type === "invalid");
594
- !(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant2__default.default(false) : undefined;
621
+ !(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant3__default.default(false) : undefined;
595
622
  });
596
623
  ontologyDefinition.objectTypes[apiName] = {
597
624
  ...objectDef,
@@ -628,7 +655,7 @@ function validateInterfaceImplProperty(spt, mappedObjectProp, object) {
628
655
  // src/cli/main.ts
629
656
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
630
657
  async function main(args = process.argv) {
631
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.10.0-beta.13").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
658
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.10.0-beta.14").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
632
659
  input: {
633
660
  alias: "i",
634
661
  describe: "Input file",
@@ -665,8 +692,8 @@ async function main(args = process.argv) {
665
692
  let apiNamespace = "";
666
693
  if (commandLineOpts.apiNamespace.length !== 0) {
667
694
  apiNamespace = commandLineOpts.apiNamespace.slice(-1) !== "." ? commandLineOpts.apiNamespace + "." : commandLineOpts.apiNamespace;
668
- !(apiNamespace.length < 1024) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "API namespace is too long.") : invariant2__default.default(false) : undefined;
669
- !apiNamespaceRegex.test(apiNamespace) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(.[a-z0-9-]+)*.$") : invariant2__default.default(false) : undefined;
695
+ !(apiNamespace.length < 1024) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, "API namespace is too long.") : invariant3__default.default(false) : undefined;
696
+ !apiNamespaceRegex.test(apiNamespace) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, "API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(.[a-z0-9-]+)*.$") : invariant3__default.default(false) : undefined;
670
697
  }
671
698
  consola.consola.info(`Loading ontology from ${commandLineOpts.input}`);
672
699
  const ontology = await loadOntology(commandLineOpts.input, apiNamespace);
@@ -691,8 +718,8 @@ function importSharedPropertyType(opts) {
691
718
  apiName,
692
719
  packageName
693
720
  });
694
- !!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "Package name format invalid ends with period") : invariant2__default.default(false) : undefined;
695
- !(packageName.match("[A-Z]") == null) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "Package name includes upper case characters") : invariant2__default.default(false) : undefined;
721
+ !!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, "Package name format invalid ends with period") : invariant3__default.default(false) : undefined;
722
+ !(packageName.match("[A-Z]") == null) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, "Package name includes upper case characters") : invariant3__default.default(false) : undefined;
696
723
  return {
697
724
  apiName: packageName + "." + apiName,
698
725
  type: typeHint,
@@ -707,7 +734,7 @@ function importSharedPropertyType(opts) {
707
734
  }
708
735
  function defineInterfaceLinkConstraint(linkDef) {
709
736
  const fromLinkMeta = getLinkMeta(linkDef);
710
- !(linkDef.from.links.find((a) => a.metadata.apiName === fromLinkMeta.apiName) == null) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Link with apiName ${fromLinkMeta.apiName} already exists on ${linkDef.apiName}`) : invariant2__default.default(false) : undefined;
737
+ !(linkDef.from.links.find((a) => a.metadata.apiName === fromLinkMeta.apiName) == null) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Link with apiName ${fromLinkMeta.apiName} already exists on ${linkDef.apiName}`) : invariant3__default.default(false) : undefined;
711
738
  linkDef.from.links.push({
712
739
  cardinality: linkDef.toMany ? "MANY" : "SINGLE",
713
740
  linkedEntityTypeId: getLinkedType(linkDef.toMany ?? linkDef.toOne),
@@ -740,9 +767,9 @@ function withDefaults({
740
767
  function defineLink(linkDefinition) {
741
768
  if ("one" in linkDefinition) {
742
769
  const foreignKey = linkDefinition.toMany.object.properties?.find((prop) => prop.apiName === linkDefinition.manyForeignKeyProperty);
743
- !(foreignKey !== undefined) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Foreign key ${linkDefinition.manyForeignKeyProperty} on link ${linkDefinition.id} does not exist on object ${linkDefinition.toMany.object.apiName}}`) : invariant2__default.default(false) : undefined;
770
+ !(foreignKey !== undefined) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Foreign key ${linkDefinition.manyForeignKeyProperty} on link ${linkDefinition.id} does not exist on object ${linkDefinition.toMany.object.apiName}}`) : invariant3__default.default(false) : undefined;
744
771
  const typesMatch = foreignKey.type === linkDefinition.one.object.properties?.find((prop) => prop.apiName === linkDefinition.one.object.primaryKeys[0])?.type;
745
- !typesMatch ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, `Link ${linkDefinition.id} has type mismatch between the one side's primary key and the foreign key on the many side`) : invariant2__default.default(false) : undefined;
772
+ !typesMatch ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, `Link ${linkDefinition.id} has type mismatch between the one side's primary key and the foreign key on the many side`) : invariant3__default.default(false) : undefined;
746
773
  }
747
774
  ontologyDefinition.linkTypes[linkDefinition.id] = linkDefinition;
748
775
  return linkDefinition;
@@ -799,7 +826,7 @@ function defineValueType(opts) {
799
826
  version
800
827
  } = opts;
801
828
  const semverValidation = /^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$/;
802
- !semverValidation.test(version) ? process.env.NODE_ENV !== "production" ? invariant2__default.default(false, "Version is not a valid semver") : invariant2__default.default(false) : undefined;
829
+ !semverValidation.test(version) ? process.env.NODE_ENV !== "production" ? invariant3__default.default(false, "Version is not a valid semver") : invariant3__default.default(false) : undefined;
803
830
  const typeName = typeof type.type === "string" ? type.type : type.type.type === "struct" ? "structV2" : type.type.type;
804
831
  const constraints = type.constraints ? type.constraints.map((constraint) => {
805
832
  const output = {