@osdk/maker 0.76.0 → 0.76.1-main-2ab4d7c15acb64b37bce29eadae5a6190ebf2fde
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 +10 -0
- package/README.md +1 -0
- package/build/browser/api/properties/PropertyTypeType.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/cli/main.js.map +1 -1
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.js +2 -1
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.js.map +1 -1
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +2 -1
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/cjs/index.cjs +5 -3
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +1 -0
- package/build/esm/api/properties/PropertyTypeType.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/cli/main.js.map +1 -1
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.js +2 -1
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.js.map +1 -1
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +2 -1
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/types/api/properties/PropertyTypeType.d.ts +1 -0
- package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @osdk/maker
|
|
2
2
|
|
|
3
|
+
## 0.76.1-main-2ab4d7c15acb64b37bce29eadae5a6190ebf2fde
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- de4d83e: Add phonetic search support to string properties.
|
|
8
|
+
- Updated dependencies [2ab4d7c]
|
|
9
|
+
- @osdk/api@2.76.1-main-2ab4d7c15acb64b37bce29eadae5a6190ebf2fde
|
|
10
|
+
- @osdk/typescript-sdk-docs@0.25.1-main-2ab4d7c15acb64b37bce29eadae5a6190ebf2fde
|
|
11
|
+
- @osdk/generator-converters.ontologyir@2.76.1-main-2ab4d7c15acb64b37bce29eadae5a6190ebf2fde
|
|
12
|
+
|
|
3
13
|
## 0.76.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -133,6 +133,7 @@ const descriptionProperty = defineSharedPropertyType({
|
|
|
133
133
|
isLongText: true,
|
|
134
134
|
supportsEfficientLeadingWildcard: true,
|
|
135
135
|
supportsExactMatching: false,
|
|
136
|
+
supportsPhonetic: true,
|
|
136
137
|
},
|
|
137
138
|
displayName: "Description",
|
|
138
139
|
description: "Detailed description text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyTypeType.js","names":["isPropertyTypeType","v","type","isExotic","undefined","includes","isStruct","isVector"],"sources":["PropertyTypeType.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 Analyzer,\n EmbeddingModel,\n Quantization,\n StructFieldType,\n VectorSimilarityFunction,\n} from \"@osdk/client.unstable\";\n\nexport type PropertyTypeType =\n | PropertyTypeTypePrimitive\n | PropertyTypeTypeExotic;\n\nexport type PropertyTypeTypePrimitive =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"short\"\n | \"string\"\n | \"timestamp\"\n | \"attachment\";\n\nexport type PropertyTypeTypeExotic =\n | \"geopoint\"\n | \"geoshape\"\n | \"mediaReference\"\n | \"geotimeSeries\"\n | PropertyTypeTypeMarking\n | PropertyTypeTypeStruct\n | PropertyTypeTypeString\n | PropertyTypeTypeDecimal\n | PropertyTypeTypeVector;\n\ntype PropertyTypeTypeMarking = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<\n PropertyTypeTypesWithoutStruct,\n PropertyTypeTypeMarking | PropertyTypeTypeVector\n >;\n };\n mainValue?: {\n fields: string | Array<string>;\n // TODO(ethana): we can infer this type from fields\n type: PropertyTypeType;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText?: boolean;\n supportsEfficientLeadingWildcard?: boolean;\n supportsExactMatching?: boolean;\n supportsFullTextRegex?: boolean;\n enableAsciiFolding?: boolean;\n analyzerOverride?: Analyzer;\n};\n\ntype PropertyTypeTypeDecimal = {\n type: \"decimal\";\n precision?: number;\n scale?: number;\n};\n\nexport type PropertyTypeTypeVector = {\n type: \"vector\";\n /** The dimensionality of the vector (must be at least 1). */\n dimension: number;\n /** The similarity function this vector supports for vector search. */\n supportsSearchWith: VectorSimilarityFunction;\n embeddingModel?: EmbeddingModel;\n quantization?: Quantization;\n};\n\nexport type PropertyTypeTypesWithoutStruct = Exclude<\n PropertyTypeType,\n PropertyTypeTypeStruct\n>;\nexport function isPropertyTypeType(v: PropertyTypeType): v is PropertyTypeType {\n return (\n v === \"boolean\" ||\n v === \"byte\" ||\n v === \"date\" ||\n v === \"decimal\" ||\n v === \"double\" ||\n v === \"float\" ||\n v === \"geopoint\" ||\n v === \"geoshape\" ||\n v === \"integer\" ||\n v === \"long\" ||\n (typeof v === \"object\" && v.type === \"marking\") ||\n v === \"short\" ||\n v === \"string\" ||\n v === \"timestamp\"\n );\n}\nexport function isExotic(\n type: PropertyTypeType | undefined,\n): type is PropertyTypeTypeExotic {\n if (type === undefined) {\n return false;\n }\n if (typeof type === \"string\") {\n return [\"geopoint\", \"geoshape\", \"mediaReference\", \"geotimeSeries\"].includes(\n type,\n );\n } else if (typeof type === \"object\" && type != null) {\n return (\n type.type === \"marking\" ||\n type.type === \"struct\" ||\n type.type === \"string\" ||\n type.type === \"decimal\" ||\n type.type === \"vector\"\n );\n }\n return false;\n}\nexport function isStruct(\n type: PropertyTypeType,\n): type is PropertyTypeTypeStruct {\n return typeof type === \"object\" && type.type === \"struct\";\n}\nexport function isVector(\n type: PropertyTypeType,\n): type is PropertyTypeTypeVector {\n return typeof type === \"object\" && type.type === \"vector\";\n}\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends Optional<\n Omit<StructFieldType, \"fieldType\" | \"structFieldRid\" | \"apiName\">,\n \"typeClasses\" | \"aliases\"\n> {\n fieldType: PropertyTypeTypesWithoutStruct;\n requireImplementation?: boolean;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"PropertyTypeType.js","names":["isPropertyTypeType","v","type","isExotic","undefined","includes","isStruct","isVector"],"sources":["PropertyTypeType.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 Analyzer,\n EmbeddingModel,\n Quantization,\n StructFieldType,\n VectorSimilarityFunction,\n} from \"@osdk/client.unstable\";\n\nexport type PropertyTypeType =\n | PropertyTypeTypePrimitive\n | PropertyTypeTypeExotic;\n\nexport type PropertyTypeTypePrimitive =\n | \"boolean\"\n | \"byte\"\n | \"date\"\n | \"decimal\"\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"short\"\n | \"string\"\n | \"timestamp\"\n | \"attachment\";\n\nexport type PropertyTypeTypeExotic =\n | \"geopoint\"\n | \"geoshape\"\n | \"mediaReference\"\n | \"geotimeSeries\"\n | PropertyTypeTypeMarking\n | PropertyTypeTypeStruct\n | PropertyTypeTypeString\n | PropertyTypeTypeDecimal\n | PropertyTypeTypeVector;\n\ntype PropertyTypeTypeMarking = {\n type: \"marking\";\n markingType: \"MANDATORY\" | \"CBAC\";\n markingInputGroupName: string;\n};\n\nexport type PropertyTypeTypeStruct = {\n type: \"struct\";\n structDefinition: {\n [api_name: string]:\n | StructPropertyType\n | Exclude<\n PropertyTypeTypesWithoutStruct,\n PropertyTypeTypeMarking | PropertyTypeTypeVector\n >;\n };\n mainValue?: {\n fields: string | Array<string>;\n // TODO(ethana): we can infer this type from fields\n type: PropertyTypeType;\n };\n};\n\ntype PropertyTypeTypeString = {\n type: \"string\";\n isLongText?: boolean;\n supportsEfficientLeadingWildcard?: boolean;\n supportsExactMatching?: boolean;\n supportsFullTextRegex?: boolean;\n supportsPhonetic?: boolean;\n enableAsciiFolding?: boolean;\n analyzerOverride?: Analyzer;\n};\n\ntype PropertyTypeTypeDecimal = {\n type: \"decimal\";\n precision?: number;\n scale?: number;\n};\n\nexport type PropertyTypeTypeVector = {\n type: \"vector\";\n /** The dimensionality of the vector (must be at least 1). */\n dimension: number;\n /** The similarity function this vector supports for vector search. */\n supportsSearchWith: VectorSimilarityFunction;\n embeddingModel?: EmbeddingModel;\n quantization?: Quantization;\n};\n\nexport type PropertyTypeTypesWithoutStruct = Exclude<\n PropertyTypeType,\n PropertyTypeTypeStruct\n>;\nexport function isPropertyTypeType(v: PropertyTypeType): v is PropertyTypeType {\n return (\n v === \"boolean\" ||\n v === \"byte\" ||\n v === \"date\" ||\n v === \"decimal\" ||\n v === \"double\" ||\n v === \"float\" ||\n v === \"geopoint\" ||\n v === \"geoshape\" ||\n v === \"integer\" ||\n v === \"long\" ||\n (typeof v === \"object\" && v.type === \"marking\") ||\n v === \"short\" ||\n v === \"string\" ||\n v === \"timestamp\"\n );\n}\nexport function isExotic(\n type: PropertyTypeType | undefined,\n): type is PropertyTypeTypeExotic {\n if (type === undefined) {\n return false;\n }\n if (typeof type === \"string\") {\n return [\"geopoint\", \"geoshape\", \"mediaReference\", \"geotimeSeries\"].includes(\n type,\n );\n } else if (typeof type === \"object\" && type != null) {\n return (\n type.type === \"marking\" ||\n type.type === \"struct\" ||\n type.type === \"string\" ||\n type.type === \"decimal\" ||\n type.type === \"vector\"\n );\n }\n return false;\n}\nexport function isStruct(\n type: PropertyTypeType,\n): type is PropertyTypeTypeStruct {\n return typeof type === \"object\" && type.type === \"struct\";\n}\nexport function isVector(\n type: PropertyTypeType,\n): type is PropertyTypeTypeVector {\n return typeof type === \"object\" && type.type === \"vector\";\n}\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport interface StructPropertyType extends Optional<\n Omit<StructFieldType, \"fieldType\" | \"structFieldRid\" | \"apiName\">,\n \"typeClasses\" | \"aliases\"\n> {\n fieldType: PropertyTypeTypesWithoutStruct;\n requireImplementation?: boolean;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6FA,OAAO,SAASA,kBAAkBA,CAACC,CAAmB,EAAyB;EAC7E,OACEA,CAAC,KAAK,SAAS,IACfA,CAAC,KAAK,MAAM,IACZA,CAAC,KAAK,MAAM,IACZA,CAAC,KAAK,SAAS,IACfA,CAAC,KAAK,QAAQ,IACdA,CAAC,KAAK,OAAO,IACbA,CAAC,KAAK,UAAU,IAChBA,CAAC,KAAK,UAAU,IAChBA,CAAC,KAAK,SAAS,IACfA,CAAC,KAAK,MAAM,IACX,OAAOA,CAAC,KAAK,QAAQ,IAAIA,CAAC,CAACC,IAAI,KAAK,SAAU,IAC/CD,CAAC,KAAK,OAAO,IACbA,CAAC,KAAK,QAAQ,IACdA,CAAC,KAAK,WAAW;AAErB;AACA,OAAO,SAASE,QAAQA,CACtBD,IAAkC,EACF;EAChC,IAAIA,IAAI,KAAKE,SAAS,EAAE;IACtB,OAAO,KAAK;EACd;EACA,IAAI,OAAOF,IAAI,KAAK,QAAQ,EAAE;IAC5B,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAACG,QAAQ,CACzEH,IACF,CAAC;EACH,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,IAAI,IAAI,EAAE;IACnD,OACEA,IAAI,CAACA,IAAI,KAAK,SAAS,IACvBA,IAAI,CAACA,IAAI,KAAK,QAAQ,IACtBA,IAAI,CAACA,IAAI,KAAK,QAAQ,IACtBA,IAAI,CAACA,IAAI,KAAK,SAAS,IACvBA,IAAI,CAACA,IAAI,KAAK,QAAQ;EAE1B;EACA,OAAO,KAAK;AACd;AACA,OAAO,SAASI,QAAQA,CACtBJ,IAAsB,EACU;EAChC,OAAO,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;AAC3D;AACA,OAAO,SAASK,QAAQA,CACtBL,IAAsB,EACU;EAChC,OAAO,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;AAC3D","ignoreList":[]}
|
|
@@ -27,7 +27,7 @@ import { reconcileOntologySchemaLockfile } from "../lockfile/reconcileOntologySc
|
|
|
27
27
|
const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/u;
|
|
28
28
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
29
29
|
export default async function main(args = process.argv) {
|
|
30
|
-
const commandLineOpts = await yargs(hideBin(args)).version("0.76.
|
|
30
|
+
const commandLineOpts = await yargs(hideBin(args)).version("0.76.1-main-2ab4d7c15acb64b37bce29eadae5a6190ebf2fde" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
|
|
31
31
|
input: {
|
|
32
32
|
alias: "i",
|
|
33
33
|
describe: "Input file",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","names":["fs","path","pathToFileURL","consola","LogLevels","invariant","yargs","hideBin","defineOntology","DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME","reconcileOntologySchemaLockfile","apiNamespaceRegex","uuidRegex","main","args","process","argv","commandLineOpts","version","wrap","Math","min","terminalWidth","strict","help","options","input","alias","describe","type","default","coerce","resolve","output","apiNamespace","snapshotDir","outputDir","valueTypesOutput","dependencies","generateCodeSnippets","codeSnippetPackageName","codeSnippetDir","randomnessKey","lockfile","writeLocks","yes","verbose","count","middleware","level","logLevelFor","implies","fail","msg","err","usage","showHelp","Error","parseAsync","length","slice","env","NODE_ENV","test","info","undefined","lockfilePath","join","dirname","ontologyIr","loadOntology","ontology","assumeYes","writeFile","JSON","stringify","key","value","valueTypes","importedValueTypes","verbosity","debug","trace","dependencyFile","snippetPackageName","beforeWrite","q","href"],"sources":["main.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 * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { LogLevel } from \"consola\";\nimport { consola, LogLevels } from \"consola\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport type { OntologyDefinition } from \"../api/common/OntologyDefinition.js\";\nimport { defineOntology } from \"../api/defineOntology.js\";\nimport { DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME } from \"../lockfile/OntologySchemaLockfile.js\";\nimport { reconcileOntologySchemaLockfile } from \"../lockfile/reconcileOntologySchemaLockfile.js\";\n\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/u;\nconst uuidRegex =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;\n\nexport default async function main(\n args: string[] = process.argv,\n): Promise<void> {\n const commandLineOpts: {\n input: string;\n output: string;\n apiNamespace: string;\n snapshotDir: string;\n valueTypesOutput: string;\n outputDir?: string;\n dependencies?: string;\n generateCodeSnippets: boolean;\n codeSnippetPackageName: string;\n codeSnippetDir: string;\n randomnessKey?: string;\n lockfile?: string;\n writeLocks?: boolean;\n yes?: boolean;\n verbose: number;\n } = await yargs(hideBin(args))\n .version(process.env.PACKAGE_VERSION ?? \"\")\n .wrap(Math.min(150, yargs().terminalWidth()))\n .strict()\n .help()\n .options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\",\n coerce: path.resolve,\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\",\n coerce: path.resolve,\n },\n apiNamespace: {\n describe: \"Api name prefix for namespaced ontology types\",\n type: \"string\",\n default: \"\",\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve,\n },\n outputDir: {\n alias: \"d\",\n describe: \"Directory for generated ontology entities\",\n type: \"string\",\n coerce: path.resolve,\n },\n valueTypesOutput: {\n describe: \"Value Type Output File\",\n type: \"string\",\n default: \"value-types.json\",\n coerce: path.resolve,\n },\n dependencies: {\n describe: \"File to write dependencies to\",\n type: \"string\",\n coerce: path.resolve,\n },\n generateCodeSnippets: {\n describe: \"Enable code snippet files creation\",\n type: \"boolean\",\n default: false,\n },\n codeSnippetPackageName: {\n describe:\n \"The package name that will be displayed in the code snippets\",\n default: \"\",\n type: \"string\",\n },\n codeSnippetDir: {\n describe: \"Directory for generated code snippet files\",\n type: \"string\",\n default: \"./\",\n coerce: path.resolve,\n },\n randomnessKey: {\n describe: \"Value used to assure uniqueness of entities\",\n type: \"string\",\n },\n lockfile: {\n describe: `Ontology schema lockfile path (default: ${DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME} beside --input)`,\n type: \"string\",\n // No `default`: it depends on --input, which `coerce` cannot see. Resolved after parsing.\n coerce: path.resolve,\n },\n writeLocks: {\n describe:\n \"Update the ontology schema lockfile instead of failing when it is out of date\",\n type: \"boolean\",\n // NB: no default since \"implied\" below\n },\n yes: {\n alias: \"y\",\n describe:\n \"Accept detected ontology schema migration finalizations/deletions without prompting\",\n type: \"boolean\",\n // NB: no default since \"implied\" below\n },\n verbose: {\n alias: \"v\",\n describe:\n \"Enable verbose logging: -v for debug, including stack traces on failure, -vv for trace\",\n type: \"boolean\",\n count: true,\n },\n })\n .middleware(({ verbose }) => {\n consola.level = logLevelFor(verbose);\n }, true)\n // --yes only answers the prompt that --write-locks can raise, so on its own it does nothing.\n .implies(\"yes\", \"writeLocks\")\n // Without this, the usage error that `implies` raises calls `process.exit` from inside the\n // library, which takes the whole host process with it.\n .fail((msg, err, usage) => {\n if (err) {\n throw err;\n }\n\n // Registering a failure handler suppresses yargs' showHelpOnFail behavior, so reinstate it.\n usage.showHelp(\"error\");\n throw new Error(msg);\n })\n .parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace =\n commandLineOpts.apiNamespace.slice(-1) !== \".\"\n ? commandLineOpts.apiNamespace + \".\"\n : commandLineOpts.apiNamespace;\n invariant(apiNamespace.length < 1024, \"API namespace is too long.\");\n invariant(\n apiNamespaceRegex.test(apiNamespace),\n \"API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$\",\n );\n }\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n\n if (\n !commandLineOpts.generateCodeSnippets &&\n (commandLineOpts.codeSnippetPackageName !== \"\" ||\n commandLineOpts.codeSnippetDir !== path.resolve(\"./\"))\n ) {\n consola.info(\n \"Package name and/or directory supplied for code snippets, but code snippet generation is false.\",\n );\n }\n\n if (commandLineOpts.randomnessKey !== undefined) {\n invariant(\n uuidRegex.test(commandLineOpts.randomnessKey),\n \"Supplied randomness key is not a uuid and shouldn't be used as a uniqueness guarantee\",\n );\n }\n\n // The lockfile is a checked-in source artifact describing the ontology definition, not a build artifact\n // like `output`, so it belongs beside the definition rather than wherever maker was invoked.\n const lockfilePath =\n commandLineOpts.lockfile ??\n path.join(\n path.dirname(commandLineOpts.input),\n DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME,\n );\n\n const ontologyIr = await loadOntology(\n commandLineOpts.input,\n apiNamespace,\n commandLineOpts.outputDir,\n commandLineOpts.dependencies,\n commandLineOpts.generateCodeSnippets,\n commandLineOpts.codeSnippetPackageName,\n commandLineOpts.codeSnippetDir,\n commandLineOpts.randomnessKey,\n // An ontology that fails lockfile checks would fail at installation-time, so the ontology-ir\n // should never reach disk at all.\n async (ontology) =>\n await reconcileOntologySchemaLockfile({\n ontology,\n lockfilePath,\n writeLocks: commandLineOpts.writeLocks ?? false,\n assumeYes: commandLineOpts.yes ?? false,\n }),\n );\n\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await fs.writeFile(\n commandLineOpts.output,\n JSON.stringify(\n ontologyIr,\n (key, value) => (key === \"linkedInterfaces\" ? undefined : value),\n 2,\n ),\n );\n // No point in generating block if there aren't any value types\n if (\n ontologyIr.valueTypes.valueTypes.length > 0 ||\n ontologyIr.importedValueTypes.valueTypes.length > 0\n ) {\n await fs.writeFile(\n commandLineOpts.valueTypesOutput,\n JSON.stringify(ontologyIr.valueTypes, null, 2),\n );\n }\n}\n\nfunction logLevelFor(verbosity: number): LogLevel {\n if (verbosity === 0) return LogLevels.info;\n if (verbosity === 1) return LogLevels.debug;\n return LogLevels.trace;\n}\n\nasync function loadOntology(\n input: string,\n apiNamespace: string,\n outputDir: string | undefined,\n dependencyFile: string | undefined,\n generateCodeSnippets: boolean,\n snippetPackageName: string,\n codeSnippetDir: string,\n randomnessKey: string | undefined,\n beforeWrite: (ontology: OntologyDefinition) => Promise<void>,\n) {\n const q = await defineOntology(\n apiNamespace,\n async () => await import(pathToFileURL(input).href),\n outputDir,\n dependencyFile,\n generateCodeSnippets,\n snippetPackageName,\n codeSnippetDir,\n randomnessKey,\n beforeWrite,\n );\n return q;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,EAAE,MAAM,kBAAkB;AACtC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,SAASC,aAAa,QAAQ,UAAU;AAGxC,SAASC,OAAO,EAAEC,SAAS,QAAQ,SAAS;AAC5C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AAGvC,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,qCAAqC,QAAQ,uCAAuC;AAC7F,SAASC,+BAA+B,QAAQ,gDAAgD;AAEhG,MAAMC,iBAAiB,GAAG,gCAAgC;AAC1D,MAAMC,SAAS,GACb,iEAAiE;AAEnE,eAAe,eAAeC,IAAIA,CAChCC,IAAc,GAAGC,OAAO,CA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AAEA,SAAS5B,WAAWA,CAAC8B,SAAiB,EAAY;EAChD,IAAIA,SAAS,KAAK,CAAC,EAAE,OAAO5E,SAAS,CAAC4D,IAAI;EAC1C,IAAIgB,SAAS,KAAK,CAAC,EAAE,OAAO5E,SAAS,CAAC6E,KAAK;EAC3C,OAAO7E,SAAS,CAAC8E,KAAK;AACxB;AAEA,eAAeZ,YAAYA,CACzB5C,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7B+C,cAAkC,EAClC5C,oBAA6B,EAC7B6C,kBAA0B,EAC1B3C,cAAsB,EACtBC,aAAiC,EACjC2C,WAA4D,EAC5D;EACA,MAAMC,CAAC,GAAG,MAAM9E,cAAc,CAC5B0B,YAAY,EACZ,YAAY,MAAM,MAAM,CAAChC,aAAa,CAACwB,KAAK,CAAC,CAAC6D,IAAI,CAAC,EACnDnD,SAAS,EACT+C,cAAc,EACd5C,oBAAoB,EACpB6C,kBAAkB,EAClB3C,cAAc,EACdC,aAAa,EACb2C,WACF,CAAC;EACD,OAAOC,CAAC;AACV","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"main.js","names":["fs","path","pathToFileURL","consola","LogLevels","invariant","yargs","hideBin","defineOntology","DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME","reconcileOntologySchemaLockfile","apiNamespaceRegex","uuidRegex","main","args","process","argv","commandLineOpts","version","wrap","Math","min","terminalWidth","strict","help","options","input","alias","describe","type","default","coerce","resolve","output","apiNamespace","snapshotDir","outputDir","valueTypesOutput","dependencies","generateCodeSnippets","codeSnippetPackageName","codeSnippetDir","randomnessKey","lockfile","writeLocks","yes","verbose","count","middleware","level","logLevelFor","implies","fail","msg","err","usage","showHelp","Error","parseAsync","length","slice","env","NODE_ENV","test","info","undefined","lockfilePath","join","dirname","ontologyIr","loadOntology","ontology","assumeYes","writeFile","JSON","stringify","key","value","valueTypes","importedValueTypes","verbosity","debug","trace","dependencyFile","snippetPackageName","beforeWrite","q","href"],"sources":["main.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 * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { LogLevel } from \"consola\";\nimport { consola, LogLevels } from \"consola\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport type { OntologyDefinition } from \"../api/common/OntologyDefinition.js\";\nimport { defineOntology } from \"../api/defineOntology.js\";\nimport { DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME } from \"../lockfile/OntologySchemaLockfile.js\";\nimport { reconcileOntologySchemaLockfile } from \"../lockfile/reconcileOntologySchemaLockfile.js\";\n\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/u;\nconst uuidRegex =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;\n\nexport default async function main(\n args: string[] = process.argv,\n): Promise<void> {\n const commandLineOpts: {\n input: string;\n output: string;\n apiNamespace: string;\n snapshotDir: string;\n valueTypesOutput: string;\n outputDir?: string;\n dependencies?: string;\n generateCodeSnippets: boolean;\n codeSnippetPackageName: string;\n codeSnippetDir: string;\n randomnessKey?: string;\n lockfile?: string;\n writeLocks?: boolean;\n yes?: boolean;\n verbose: number;\n } = await yargs(hideBin(args))\n .version(process.env.PACKAGE_VERSION ?? \"\")\n .wrap(Math.min(150, yargs().terminalWidth()))\n .strict()\n .help()\n .options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\",\n coerce: path.resolve,\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\",\n coerce: path.resolve,\n },\n apiNamespace: {\n describe: \"Api name prefix for namespaced ontology types\",\n type: \"string\",\n default: \"\",\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve,\n },\n outputDir: {\n alias: \"d\",\n describe: \"Directory for generated ontology entities\",\n type: \"string\",\n coerce: path.resolve,\n },\n valueTypesOutput: {\n describe: \"Value Type Output File\",\n type: \"string\",\n default: \"value-types.json\",\n coerce: path.resolve,\n },\n dependencies: {\n describe: \"File to write dependencies to\",\n type: \"string\",\n coerce: path.resolve,\n },\n generateCodeSnippets: {\n describe: \"Enable code snippet files creation\",\n type: \"boolean\",\n default: false,\n },\n codeSnippetPackageName: {\n describe:\n \"The package name that will be displayed in the code snippets\",\n default: \"\",\n type: \"string\",\n },\n codeSnippetDir: {\n describe: \"Directory for generated code snippet files\",\n type: \"string\",\n default: \"./\",\n coerce: path.resolve,\n },\n randomnessKey: {\n describe: \"Value used to assure uniqueness of entities\",\n type: \"string\",\n },\n lockfile: {\n describe: `Ontology schema lockfile path (default: ${DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME} beside --input)`,\n type: \"string\",\n // No `default`: it depends on --input, which `coerce` cannot see. Resolved after parsing.\n coerce: path.resolve,\n },\n writeLocks: {\n describe:\n \"Update the ontology schema lockfile instead of failing when it is out of date\",\n type: \"boolean\",\n // NB: no default since \"implied\" below\n },\n yes: {\n alias: \"y\",\n describe:\n \"Accept detected ontology schema migration finalizations/deletions without prompting\",\n type: \"boolean\",\n // NB: no default since \"implied\" below\n },\n verbose: {\n alias: \"v\",\n describe:\n \"Enable verbose logging: -v for debug, including stack traces on failure, -vv for trace\",\n type: \"boolean\",\n count: true,\n },\n })\n .middleware(({ verbose }) => {\n consola.level = logLevelFor(verbose);\n }, true)\n // --yes only answers the prompt that --write-locks can raise, so on its own it does nothing.\n .implies(\"yes\", \"writeLocks\")\n // Without this, the usage error that `implies` raises calls `process.exit` from inside the\n // library, which takes the whole host process with it.\n .fail((msg, err, usage) => {\n if (err) {\n throw err;\n }\n\n // Registering a failure handler suppresses yargs' showHelpOnFail behavior, so reinstate it.\n usage.showHelp(\"error\");\n throw new Error(msg);\n })\n .parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace =\n commandLineOpts.apiNamespace.slice(-1) !== \".\"\n ? commandLineOpts.apiNamespace + \".\"\n : commandLineOpts.apiNamespace;\n invariant(apiNamespace.length < 1024, \"API namespace is too long.\");\n invariant(\n apiNamespaceRegex.test(apiNamespace),\n \"API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$\",\n );\n }\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n\n if (\n !commandLineOpts.generateCodeSnippets &&\n (commandLineOpts.codeSnippetPackageName !== \"\" ||\n commandLineOpts.codeSnippetDir !== path.resolve(\"./\"))\n ) {\n consola.info(\n \"Package name and/or directory supplied for code snippets, but code snippet generation is false.\",\n );\n }\n\n if (commandLineOpts.randomnessKey !== undefined) {\n invariant(\n uuidRegex.test(commandLineOpts.randomnessKey),\n \"Supplied randomness key is not a uuid and shouldn't be used as a uniqueness guarantee\",\n );\n }\n\n // The lockfile is a checked-in source artifact describing the ontology definition, not a build artifact\n // like `output`, so it belongs beside the definition rather than wherever maker was invoked.\n const lockfilePath =\n commandLineOpts.lockfile ??\n path.join(\n path.dirname(commandLineOpts.input),\n DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME,\n );\n\n const ontologyIr = await loadOntology(\n commandLineOpts.input,\n apiNamespace,\n commandLineOpts.outputDir,\n commandLineOpts.dependencies,\n commandLineOpts.generateCodeSnippets,\n commandLineOpts.codeSnippetPackageName,\n commandLineOpts.codeSnippetDir,\n commandLineOpts.randomnessKey,\n // An ontology that fails lockfile checks would fail at installation-time, so the ontology-ir\n // should never reach disk at all.\n async (ontology) =>\n await reconcileOntologySchemaLockfile({\n ontology,\n lockfilePath,\n writeLocks: commandLineOpts.writeLocks ?? false,\n assumeYes: commandLineOpts.yes ?? false,\n }),\n );\n\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await fs.writeFile(\n commandLineOpts.output,\n JSON.stringify(\n ontologyIr,\n (key, value) => (key === \"linkedInterfaces\" ? undefined : value),\n 2,\n ),\n );\n // No point in generating block if there aren't any value types\n if (\n ontologyIr.valueTypes.valueTypes.length > 0 ||\n ontologyIr.importedValueTypes.valueTypes.length > 0\n ) {\n await fs.writeFile(\n commandLineOpts.valueTypesOutput,\n JSON.stringify(ontologyIr.valueTypes, null, 2),\n );\n }\n}\n\nfunction logLevelFor(verbosity: number): LogLevel {\n if (verbosity === 0) return LogLevels.info;\n if (verbosity === 1) return LogLevels.debug;\n return LogLevels.trace;\n}\n\nasync function loadOntology(\n input: string,\n apiNamespace: string,\n outputDir: string | undefined,\n dependencyFile: string | undefined,\n generateCodeSnippets: boolean,\n snippetPackageName: string,\n codeSnippetDir: string,\n randomnessKey: string | undefined,\n beforeWrite: (ontology: OntologyDefinition) => Promise<void>,\n) {\n const q = await defineOntology(\n apiNamespace,\n async () => await import(pathToFileURL(input).href),\n outputDir,\n dependencyFile,\n generateCodeSnippets,\n snippetPackageName,\n codeSnippetDir,\n randomnessKey,\n beforeWrite,\n );\n return q;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,EAAE,MAAM,kBAAkB;AACtC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,SAASC,aAAa,QAAQ,UAAU;AAGxC,SAASC,OAAO,EAAEC,SAAS,QAAQ,SAAS;AAC5C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,O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IACER,UAAU,CAACS,UAAU,CAACA,UAAU,CAACnB,MAAM,GAAG,CAAC,IAC3CU,UAAU,CAACU,kBAAkB,CAACD,UAAU,CAACnB,MAAM,GAAG,CAAC,EACnD;IACA,MAAM3D,EAAE,CAACyE,SAAS,CAChBxD,eAAe,CAACoB,gBAAgB,EAChCqC,IAAI,CAACC,SAAS,CAACN,UAAU,CAACS,UAAU,EAAE,IAAI,EAAE,CAAC,CAC/C,CAAC;EACH;AACF;AAEA,SAAS5B,WAAWA,CAAC8B,SAAiB,EAAY;EAChD,IAAIA,SAAS,KAAK,CAAC,EAAE,OAAO5E,SAAS,CAAC4D,IAAI;EAC1C,IAAIgB,SAAS,KAAK,CAAC,EAAE,OAAO5E,SAAS,CAAC6E,KAAK;EAC3C,OAAO7E,SAAS,CAAC8E,KAAK;AACxB;AAEA,eAAeZ,YAAYA,CACzB5C,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7B+C,cAAkC,EAClC5C,oBAA6B,EAC7B6C,kBAA0B,EAC1B3C,cAAsB,EACtBC,aAAiC,EACjC2C,WAA4D,EAC5D;EACA,MAAMC,CAAC,GAAG,MAAM9E,cAAc,CAC5B0B,YAAY,EACZ,YAAY,MAAM,MAAM,CAAChC,aAAa,CAACwB,KAAK,CAAC,CAAC6D,IAAI,CAAC,EACnDnD,SAAS,EACT+C,cAAc,EACd5C,oBAAoB,EACpB6C,kBAAkB,EAClB3C,cAAc,EACdC,aAAa,EACb2C,WACF,CAAC;EACD,OAAOC,CAAC;AACV","ignoreList":[]}
|
|
@@ -87,7 +87,8 @@ export function propertyTypeTypeToOntologyIrInterfaceType(type) {
|
|
|
87
87
|
isLongText: type.isLongText ?? false,
|
|
88
88
|
supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard ?? false,
|
|
89
89
|
supportsExactMatching: type.supportsExactMatching ?? true,
|
|
90
|
-
supportsFullTextRegex: type.supportsFullTextRegex
|
|
90
|
+
supportsFullTextRegex: type.supportsFullTextRegex,
|
|
91
|
+
supportsPhonetic: type.supportsPhonetic
|
|
91
92
|
}
|
|
92
93
|
};
|
|
93
94
|
case typeof type === "object" && type.type === "decimal":
|
package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTypeTypeToOntologyIrInterfaceType.js","names":["distributeTypeHelper","propertyTypeTypeToOntologyIrInterfaceType","type","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","field","apiName","displayMetadata","displayName","description","undefined","typeClasses","aliases","fieldType","requireImplementation","push","struct","string","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","supportsFullTextRegex","decimal","precision","scale","vector","dimension","supportsSearchWith","embeddingModel","quantization","geohash","mediaReference","geotimeSeriesReference","Error","JSON","stringify"],"sources":["propertyTypeTypeToOntologyIrInterfaceType.ts"],"sourcesContent":["/*\n * Copyright 2026 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 OntologyIrInterfacePropertyTypeType,\n OntologyIrInterfaceStructFieldType,\n} from \"@osdk/client.unstable\";\n\nimport type { PropertyTypeType } from \"../../api/properties/PropertyTypeType.js\";\nimport { distributeTypeHelper } from \"../toConjure/distributeTypeHelper.js\";\n\nexport function propertyTypeTypeToOntologyIrInterfaceType(\n type: PropertyTypeType,\n): OntologyIrInterfacePropertyTypeType {\n switch (true) {\n case typeof type === \"object\" && type.type === \"marking\":\n return {\n type: \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case typeof type === \"object\" && type.type === \"struct\":\n const structFields: Array<OntologyIrInterfaceStructFieldType> =\n new Array();\n for (const key in type.structDefinition) {\n const fieldTypeDefinition = type.structDefinition[key];\n let field: OntologyIrInterfaceStructFieldType;\n if (typeof fieldTypeDefinition === \"string\") {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType:\n propertyTypeTypeToOntologyIrInterfaceType(fieldTypeDefinition),\n requireImplementation: true,\n };\n } else {\n // If it is a full form type definition then process it as such\n if (\n typeof fieldTypeDefinition === \"object\" &&\n \"fieldType\" in fieldTypeDefinition\n ) {\n field = {\n ...fieldTypeDefinition,\n apiName: key,\n fieldType: propertyTypeTypeToOntologyIrInterfaceType(\n fieldTypeDefinition.fieldType,\n ),\n displayMetadata: fieldTypeDefinition.displayMetadata ?? {\n displayName: key,\n description: undefined,\n },\n typeClasses: fieldTypeDefinition.typeClasses ?? [],\n aliases: fieldTypeDefinition.aliases ?? [],\n requireImplementation:\n fieldTypeDefinition.requireImplementation ?? true,\n };\n } else {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType:\n propertyTypeTypeToOntologyIrInterfaceType(fieldTypeDefinition),\n requireImplementation: true,\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: { structFields },\n };\n\n case typeof type === \"object\" && type.type === \"string\":\n return {\n type: \"string\",\n string: {\n analyzerOverride: type.analyzerOverride,\n enableAsciiFolding: type.enableAsciiFolding,\n isLongText: type.isLongText ?? false,\n supportsEfficientLeadingWildcard:\n type.supportsEfficientLeadingWildcard ?? false,\n supportsExactMatching: type.supportsExactMatching ?? true,\n supportsFullTextRegex: type.supportsFullTextRegex,\n },\n };\n\n case typeof type === \"object\" && type.type === \"decimal\":\n return {\n type: \"decimal\",\n decimal: {\n precision: type.precision,\n scale: type.scale,\n },\n };\n\n case typeof type === \"object\" && type.type === \"vector\":\n return {\n type: \"vector\",\n vector: {\n dimension: type.dimension,\n supportsSearchWith: [type.supportsSearchWith],\n embeddingModel: type.embeddingModel,\n quantization: type.quantization,\n },\n };\n\n case type === \"geopoint\":\n return { type: \"geohash\", geohash: {} };\n\n case type === \"decimal\":\n return { type, [type]: { precision: undefined, scale: undefined } };\n\n case type === \"string\":\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsEfficientLeadingWildcard: false,\n supportsExactMatching: true,\n },\n };\n\n case type === \"mediaReference\":\n return {\n type,\n mediaReference: {},\n };\n\n case type === \"geotimeSeries\":\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n if (typeof type === \"object\") {\n throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);\n }\n return distributeTypeHelper(type);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,oBAAoB,QAAQ,sCAAsC;AAE3E,OAAO,SAASC,yCAAyCA,CACvDC,IAAsB,EACe;EACrC,QAAQ,IAAI;IACV,KAAK,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,SAAS;MACtD,OAAO;QACLA,IAAI,EAAE,SAAS;QACfC,OAAO,EAAE;UAAEC,WAAW,EAAEF,IAAI,CAACE;QAAY;MAC3C,CAAC;IAEH,KAAK,OAAOF,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;MACrD,MAAMG,YAAuD,GAC3D,IAAIC,KAAK,CAAC,CAAC;MACb,KAAK,MAAMC,GAAG,IAAIL,IAAI,CAACM,gBAAgB,EAAE;QACvC,MAAMC,mBAAmB,GAAGP,IAAI,CAACM,gBAAgB,CAACD,GAAG,CAAC;QACtD,IAAIG,KAAyC;QAC7C,IAAI,OAAOD,mBAAmB,KAAK,QAAQ,EAAE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,IAAI,KAAK,QAAQ;MACrD,OAAO;QACLA,IAAI,EAAE,QAAQ;QACdoB,MAAM,EAAE;UACNC,gBAAgB,EAAErB,IAAI,CAACqB,gBAAgB;UACvCC,kBAAkB,EAAEtB,IAAI,CAACsB,kBAAkB;UAC3CC,UAAU,EAAEvB,IAAI,CAACuB,UAAU,IAAI,KAAK;UACpCC,gCAAgC,EAC9BxB,IAAI,CAACwB,gCAAgC,IAAI,KAAK;UAChDC,qBAAqB,EAAEzB,IAAI,CAACyB,qBAAqB,IAAI,IAAI;UACzDC,qBAAqB,EAAE1B,IAAI,CAAC0B;
|
|
1
|
+
{"version":3,"file":"propertyTypeTypeToOntologyIrInterfaceType.js","names":["distributeTypeHelper","propertyTypeTypeToOntologyIrInterfaceType","type","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","field","apiName","displayMetadata","displayName","description","undefined","typeClasses","aliases","fieldType","requireImplementation","push","struct","string","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","supportsFullTextRegex","supportsPhonetic","decimal","precision","scale","vector","dimension","supportsSearchWith","embeddingModel","quantization","geohash","mediaReference","geotimeSeriesReference","Error","JSON","stringify"],"sources":["propertyTypeTypeToOntologyIrInterfaceType.ts"],"sourcesContent":["/*\n * Copyright 2026 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 OntologyIrInterfacePropertyTypeType,\n OntologyIrInterfaceStructFieldType,\n} from \"@osdk/client.unstable\";\n\nimport type { PropertyTypeType } from \"../../api/properties/PropertyTypeType.js\";\nimport { distributeTypeHelper } from \"../toConjure/distributeTypeHelper.js\";\n\nexport function propertyTypeTypeToOntologyIrInterfaceType(\n type: PropertyTypeType,\n): OntologyIrInterfacePropertyTypeType {\n switch (true) {\n case typeof type === \"object\" && type.type === \"marking\":\n return {\n type: \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case typeof type === \"object\" && type.type === \"struct\":\n const structFields: Array<OntologyIrInterfaceStructFieldType> =\n new Array();\n for (const key in type.structDefinition) {\n const fieldTypeDefinition = type.structDefinition[key];\n let field: OntologyIrInterfaceStructFieldType;\n if (typeof fieldTypeDefinition === \"string\") {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType:\n propertyTypeTypeToOntologyIrInterfaceType(fieldTypeDefinition),\n requireImplementation: true,\n };\n } else {\n // If it is a full form type definition then process it as such\n if (\n typeof fieldTypeDefinition === \"object\" &&\n \"fieldType\" in fieldTypeDefinition\n ) {\n field = {\n ...fieldTypeDefinition,\n apiName: key,\n fieldType: propertyTypeTypeToOntologyIrInterfaceType(\n fieldTypeDefinition.fieldType,\n ),\n displayMetadata: fieldTypeDefinition.displayMetadata ?? {\n displayName: key,\n description: undefined,\n },\n typeClasses: fieldTypeDefinition.typeClasses ?? [],\n aliases: fieldTypeDefinition.aliases ?? [],\n requireImplementation:\n fieldTypeDefinition.requireImplementation ?? true,\n };\n } else {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType:\n propertyTypeTypeToOntologyIrInterfaceType(fieldTypeDefinition),\n requireImplementation: true,\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: { structFields },\n };\n\n case typeof type === \"object\" && type.type === \"string\":\n return {\n type: \"string\",\n string: {\n analyzerOverride: type.analyzerOverride,\n enableAsciiFolding: type.enableAsciiFolding,\n isLongText: type.isLongText ?? false,\n supportsEfficientLeadingWildcard:\n type.supportsEfficientLeadingWildcard ?? false,\n supportsExactMatching: type.supportsExactMatching ?? true,\n supportsFullTextRegex: type.supportsFullTextRegex,\n supportsPhonetic: type.supportsPhonetic,\n },\n };\n\n case typeof type === \"object\" && type.type === \"decimal\":\n return {\n type: \"decimal\",\n decimal: {\n precision: type.precision,\n scale: type.scale,\n },\n };\n\n case typeof type === \"object\" && type.type === \"vector\":\n return {\n type: \"vector\",\n vector: {\n dimension: type.dimension,\n supportsSearchWith: [type.supportsSearchWith],\n embeddingModel: type.embeddingModel,\n quantization: type.quantization,\n },\n };\n\n case type === \"geopoint\":\n return { type: \"geohash\", geohash: {} };\n\n case type === \"decimal\":\n return { type, [type]: { precision: undefined, scale: undefined } };\n\n case type === \"string\":\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsEfficientLeadingWildcard: false,\n supportsExactMatching: true,\n },\n };\n\n case type === \"mediaReference\":\n return {\n type,\n mediaReference: {},\n };\n\n case type === \"geotimeSeries\":\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n if (typeof type === \"object\") {\n throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);\n }\n return distributeTypeHelper(type);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,oBAAoB,QAAQ,sCAAsC;AAE3E,OAAO,SAASC,yCAAyCA,CACvDC,IAAsB,EACe;EACrC,QAAQ,IAAI;IACV,KAAK,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,SAAS;MACtD,OAAO;QACLA,IAAI,EAAE,SAAS;QACfC,OAAO,EAAE;UAAEC,WAAW,EAAEF,IAAI,CAACE;QAAY;MAC3C,CAAC;IAEH,KAAK,OAAOF,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;MACrD,MAAMG,YA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IAAI,KAAK,UAAU;MACtB,OAAO;QAAEA,IAAI,EAAE,SAAS;QAAEoC,OAAO,EAAE,CAAC;MAAE,CAAC;IAEzC,KAAKpC,IAAI,KAAK,SAAS;MACrB,OAAO;QAAEA,IAAI;QAAE,CAACA,IAAI,GAAG;UAAE6B,SAAS,EAAEhB,SAAS;UAAEiB,KAAK,EAAEjB;QAAU;MAAE,CAAC;IAErE,KAAKb,IAAI,KAAK,QAAQ;MACpB,OAAO;QACLA,IAAI;QACJ,CAACA,IAAI,GAAG;UACNqB,gBAAgB,EAAER,SAAS;UAC3BS,kBAAkB,EAAET,SAAS;UAC7BU,UAAU,EAAE,KAAK;UACjBC,gCAAgC,EAAE,KAAK;UACvCC,qBAAqB,EAAE;QACzB;MACF,CAAC;IAEH,KAAKzB,IAAI,KAAK,gBAAgB;MAC5B,OAAO;QACLA,IAAI;QACJqC,cAAc,EAAE,CAAC;MACnB,CAAC;IAEH,KAAKrC,IAAI,KAAK,eAAe;MAC3B,OAAO;QACLA,IAAI,EAAE,wBAAwB;QAC9BsC,sBAAsB,EAAE,CAAC;MAC3B,CAAC;IAEH;MACE;MACA,IAAI,OAAOtC,IAAI,KAAK,QAAQ,EAAE;QAC5B,MAAM,IAAIuC,KAAK,CAAC,0BAA0BC,IAAI,CAACC,SAAS,CAACzC,IAAI,CAAC,EAAE,CAAC;MACnE;MACA,OAAOF,oBAAoB,CAACE,IAAI,CAAC;EACrC;AACF","ignoreList":[]}
|
|
@@ -86,7 +86,8 @@ export function propertyTypeTypeToOntologyIrType(type, apiName, sharedPropertyTy
|
|
|
86
86
|
isLongText: type.isLongText ?? false,
|
|
87
87
|
supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard ?? false,
|
|
88
88
|
supportsExactMatching: type.supportsExactMatching ?? true,
|
|
89
|
-
supportsFullTextRegex: type.supportsFullTextRegex
|
|
89
|
+
supportsFullTextRegex: type.supportsFullTextRegex,
|
|
90
|
+
supportsPhonetic: type.supportsPhonetic
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
93
|
case typeof type === "object" && type.type === "decimal":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTypeTypeToOntologyIrType.js","names":["distributeTypeHelper","convertMainValue","propertyTypeTypeToOntologyIrType","type","apiName","sharedPropertyType","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","field","displayMetadata","displayName","description","undefined","typeClasses","aliases","fieldType","push","struct","mainValue","string","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","supportsFullTextRegex","decimal","precision","scale","vector","dimension","supportsSearchWith","embeddingModel","quantization","geohash","mediaReference","geotimeSeriesReference","attachment","Error","JSON","stringify"],"sources":["propertyTypeTypeToOntologyIrType.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n OntologyIrStructFieldType,\n OntologyIrType,\n} from \"@osdk/client.unstable\";\n\nimport type { PropertyTypeType } from \"../../api/properties/PropertyTypeType.js\";\nimport type { SharedPropertyType } from \"../../api/properties/SharedPropertyType.js\";\nimport { distributeTypeHelper } from \"../toConjure/distributeTypeHelper.js\";\nimport { convertMainValue } from \"./convertMainValue.js\";\n\nexport function propertyTypeTypeToOntologyIrType(\n type: PropertyTypeType,\n apiName?: string,\n sharedPropertyType?: SharedPropertyType,\n): OntologyIrType {\n switch (true) {\n case typeof type === \"object\" && type.type === \"marking\":\n return {\n type: \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case typeof type === \"object\" && type.type === \"struct\":\n const structFields: Array<OntologyIrStructFieldType> = new Array();\n for (const key in type.structDefinition) {\n const fieldTypeDefinition = type.structDefinition[key];\n let field: OntologyIrStructFieldType;\n if (typeof fieldTypeDefinition === \"string\") {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition),\n };\n } else {\n // If it is a full form type definition then process it as such\n if (\"fieldType\" in fieldTypeDefinition) {\n field = {\n ...fieldTypeDefinition,\n apiName: key,\n fieldType: propertyTypeTypeToOntologyIrType(\n fieldTypeDefinition.fieldType,\n ),\n displayMetadata: fieldTypeDefinition.displayMetadata ?? {\n displayName: key,\n description: undefined,\n },\n typeClasses: fieldTypeDefinition.typeClasses ?? [],\n aliases: fieldTypeDefinition.aliases ?? [],\n };\n } else {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition),\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: {\n structFields,\n mainValue: convertMainValue(type, apiName, sharedPropertyType),\n },\n };\n\n case typeof type === \"object\" && type.type === \"string\":\n return {\n type: \"string\",\n string: {\n analyzerOverride: type.analyzerOverride,\n enableAsciiFolding: type.enableAsciiFolding,\n isLongText: type.isLongText ?? false,\n supportsEfficientLeadingWildcard:\n type.supportsEfficientLeadingWildcard ?? false,\n supportsExactMatching: type.supportsExactMatching ?? true,\n supportsFullTextRegex: type.supportsFullTextRegex,\n },\n };\n\n case typeof type === \"object\" && type.type === \"decimal\":\n return {\n type: \"decimal\",\n decimal: {\n precision: type.precision,\n scale: type.scale,\n },\n };\n\n case typeof type === \"object\" && type.type === \"vector\":\n return {\n type: \"vector\",\n vector: {\n dimension: type.dimension,\n supportsSearchWith: [type.supportsSearchWith],\n embeddingModel: type.embeddingModel,\n quantization: type.quantization,\n },\n };\n\n case type === \"geopoint\":\n return { type: \"geohash\", geohash: {} };\n\n case type === \"decimal\":\n return { type, [type]: { precision: undefined, scale: undefined } };\n\n case type === \"string\":\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsEfficientLeadingWildcard: false,\n supportsExactMatching: true,\n },\n };\n\n case type === \"mediaReference\":\n return {\n type,\n mediaReference: {},\n };\n\n case type === \"geotimeSeries\":\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {},\n };\n case type === \"attachment\":\n return {\n type: \"attachment\",\n attachment: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n if (typeof type === \"object\") {\n throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);\n }\n return distributeTypeHelper(type);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,oBAAoB,QAAQ,sCAAsC;AAC3E,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,OAAO,SAASC,gCAAgCA,CAC9CC,IAAsB,EACtBC,OAAgB,EAChBC,kBAAuC,EACvB;EAChB,QAAQ,IAAI;IACV,KAAK,OAAOF,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,SAAS;MACtD,OAAO;QACLA,IAAI,EAAE,SAAS;QACfG,OAAO,EAAE;UAAEC,WAAW,EAAEJ,IAAI,CAACI;QAAY;MAC3C,CAAC;IAEH,KAAK,OAAOJ,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;MACrD,MAAMK,YAA8C,GAAG,IAAIC,KAAK,CAAC,CAAC;MAClE,KAAK,MAAMC,GAAG,IAAIP,IAAI,CAACQ,gBAAgB,EAAE;QACvC,MAAMC,mBAAmB,GAAGT,IAAI,CAACQ,gBAAgB,CAACD,GAAG,CAAC;QACtD,IAAIG,KAAgC;QACpC,IAAI,OAAOD,mBAAmB,KAAK,QAAQ,EAAE;UAC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gBAAgB,EAAEtB,IAAI,CAACsB,gBAAgB;UACvCC,kBAAkB,EAAEvB,IAAI,CAACuB,kBAAkB;UAC3CC,UAAU,EAAExB,IAAI,CAACwB,UAAU,IAAI,KAAK;UACpCC,gCAAgC,EAC9BzB,IAAI,CAACyB,gCAAgC,IAAI,KAAK;UAChDC,qBAAqB,EAAE1B,IAAI,CAAC0B,qBAAqB,IAAI,IAAI;UACzDC,qBAAqB,EAAE3B,IAAI,CAAC2B;
|
|
1
|
+
{"version":3,"file":"propertyTypeTypeToOntologyIrType.js","names":["distributeTypeHelper","convertMainValue","propertyTypeTypeToOntologyIrType","type","apiName","sharedPropertyType","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","field","displayMetadata","displayName","description","undefined","typeClasses","aliases","fieldType","push","struct","mainValue","string","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","supportsFullTextRegex","supportsPhonetic","decimal","precision","scale","vector","dimension","supportsSearchWith","embeddingModel","quantization","geohash","mediaReference","geotimeSeriesReference","attachment","Error","JSON","stringify"],"sources":["propertyTypeTypeToOntologyIrType.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n OntologyIrStructFieldType,\n OntologyIrType,\n} from \"@osdk/client.unstable\";\n\nimport type { PropertyTypeType } from \"../../api/properties/PropertyTypeType.js\";\nimport type { SharedPropertyType } from \"../../api/properties/SharedPropertyType.js\";\nimport { distributeTypeHelper } from \"../toConjure/distributeTypeHelper.js\";\nimport { convertMainValue } from \"./convertMainValue.js\";\n\nexport function propertyTypeTypeToOntologyIrType(\n type: PropertyTypeType,\n apiName?: string,\n sharedPropertyType?: SharedPropertyType,\n): OntologyIrType {\n switch (true) {\n case typeof type === \"object\" && type.type === \"marking\":\n return {\n type: \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case typeof type === \"object\" && type.type === \"struct\":\n const structFields: Array<OntologyIrStructFieldType> = new Array();\n for (const key in type.structDefinition) {\n const fieldTypeDefinition = type.structDefinition[key];\n let field: OntologyIrStructFieldType;\n if (typeof fieldTypeDefinition === \"string\") {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition),\n };\n } else {\n // If it is a full form type definition then process it as such\n if (\"fieldType\" in fieldTypeDefinition) {\n field = {\n ...fieldTypeDefinition,\n apiName: key,\n fieldType: propertyTypeTypeToOntologyIrType(\n fieldTypeDefinition.fieldType,\n ),\n displayMetadata: fieldTypeDefinition.displayMetadata ?? {\n displayName: key,\n description: undefined,\n },\n typeClasses: fieldTypeDefinition.typeClasses ?? [],\n aliases: fieldTypeDefinition.aliases ?? [],\n };\n } else {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition),\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: {\n structFields,\n mainValue: convertMainValue(type, apiName, sharedPropertyType),\n },\n };\n\n case typeof type === \"object\" && type.type === \"string\":\n return {\n type: \"string\",\n string: {\n analyzerOverride: type.analyzerOverride,\n enableAsciiFolding: type.enableAsciiFolding,\n isLongText: type.isLongText ?? false,\n supportsEfficientLeadingWildcard:\n type.supportsEfficientLeadingWildcard ?? false,\n supportsExactMatching: type.supportsExactMatching ?? true,\n supportsFullTextRegex: type.supportsFullTextRegex,\n supportsPhonetic: type.supportsPhonetic,\n },\n };\n\n case typeof type === \"object\" && type.type === \"decimal\":\n return {\n type: \"decimal\",\n decimal: {\n precision: type.precision,\n scale: type.scale,\n },\n };\n\n case typeof type === \"object\" && type.type === \"vector\":\n return {\n type: \"vector\",\n vector: {\n dimension: type.dimension,\n supportsSearchWith: [type.supportsSearchWith],\n embeddingModel: type.embeddingModel,\n quantization: type.quantization,\n },\n };\n\n case type === \"geopoint\":\n return { type: \"geohash\", geohash: {} };\n\n case type === \"decimal\":\n return { type, [type]: { precision: undefined, scale: undefined } };\n\n case type === \"string\":\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsEfficientLeadingWildcard: false,\n supportsExactMatching: true,\n },\n };\n\n case type === \"mediaReference\":\n return {\n type,\n mediaReference: {},\n };\n\n case type === \"geotimeSeries\":\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {},\n };\n case type === \"attachment\":\n return {\n type: \"attachment\",\n attachment: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n if (typeof type === \"object\") {\n throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);\n }\n return distributeTypeHelper(type);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,oBAAoB,QAAQ,sCAAsC;AAC3E,SAASC,gBAAgB,QAAQ,uBAAuB;AAExD,OAAO,SAASC,gCAAgCA,CAC9CC,IAAsB,EACtBC,OAAgB,EAChBC,kBAAuC,EACvB;EAChB,QAAQ,IAAI;IACV,KAAK,OAAOF,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,SAAS;MACtD,OAAO;QACLA,IAAI,EAAE,SAAS;QACfG,OAAO,EAAE;UAAEC,WAAW,EAAEJ,IAAI,CAACI;QAAY;MAC3C,CAAC;IAEH,KAAK,OAAOJ,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;M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qC,OAAO,EAAE,CAAC;MAAE,CAAC;IAEzC,KAAKrC,IAAI,KAAK,SAAS;MACrB,OAAO;QAAEA,IAAI;QAAE,CAACA,IAAI,GAAG;UAAE8B,SAAS,EAAEhB,SAAS;UAAEiB,KAAK,EAAEjB;QAAU;MAAE,CAAC;IAErE,KAAKd,IAAI,KAAK,QAAQ;MACpB,OAAO;QACLA,IAAI;QACJ,CAACA,IAAI,GAAG;UACNsB,gBAAgB,EAAER,SAAS;UAC3BS,kBAAkB,EAAET,SAAS;UAC7BU,UAAU,EAAE,KAAK;UACjBC,gCAAgC,EAAE,KAAK;UACvCC,qBAAqB,EAAE;QACzB;MACF,CAAC;IAEH,KAAK1B,IAAI,KAAK,gBAAgB;MAC5B,OAAO;QACLA,IAAI;QACJsC,cAAc,EAAE,CAAC;MACnB,CAAC;IAEH,KAAKtC,IAAI,KAAK,eAAe;MAC3B,OAAO;QACLA,IAAI,EAAE,wBAAwB;QAC9BuC,sBAAsB,EAAE,CAAC;MAC3B,CAAC;IACH,KAAKvC,IAAI,KAAK,YAAY;MACxB,OAAO;QACLA,IAAI,EAAE,YAAY;QAClBwC,UAAU,EAAE,CAAC;MACf,CAAC;IAEH;MACE;MACA,IAAI,OAAOxC,IAAI,KAAK,QAAQ,EAAE;QAC5B,MAAM,IAAIyC,KAAK,CAAC,0BAA0BC,IAAI,CAACC,SAAS,CAAC3C,IAAI,CAAC,EAAE,CAAC;MACnE;MACA,OAAOH,oBAAoB,CAACG,IAAI,CAAC;EACrC;AACF","ignoreList":[]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1162,7 +1162,8 @@ function propertyTypeTypeToOntologyIrType(type, apiName, sharedPropertyType) {
|
|
|
1162
1162
|
isLongText: type.isLongText ?? false,
|
|
1163
1163
|
supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard ?? false,
|
|
1164
1164
|
supportsExactMatching: type.supportsExactMatching ?? true,
|
|
1165
|
-
supportsFullTextRegex: type.supportsFullTextRegex
|
|
1165
|
+
supportsFullTextRegex: type.supportsFullTextRegex,
|
|
1166
|
+
supportsPhonetic: type.supportsPhonetic
|
|
1166
1167
|
}
|
|
1167
1168
|
};
|
|
1168
1169
|
case (typeof type === "object" && type.type === "decimal"):
|
|
@@ -1352,7 +1353,8 @@ function propertyTypeTypeToOntologyIrInterfaceType(type) {
|
|
|
1352
1353
|
isLongText: type.isLongText ?? false,
|
|
1353
1354
|
supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard ?? false,
|
|
1354
1355
|
supportsExactMatching: type.supportsExactMatching ?? true,
|
|
1355
|
-
supportsFullTextRegex: type.supportsFullTextRegex
|
|
1356
|
+
supportsFullTextRegex: type.supportsFullTextRegex,
|
|
1357
|
+
supportsPhonetic: type.supportsPhonetic
|
|
1356
1358
|
}
|
|
1357
1359
|
};
|
|
1358
1360
|
case (typeof type === "object" && type.type === "decimal"):
|
|
@@ -6365,7 +6367,7 @@ async function readIfExists(path5) {
|
|
|
6365
6367
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/u;
|
|
6366
6368
|
var uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
|
|
6367
6369
|
async function main(args = process.argv) {
|
|
6368
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.76.
|
|
6370
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.76.1-main-2ab4d7c15acb64b37bce29eadae5a6190ebf2fde").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
6369
6371
|
input: {
|
|
6370
6372
|
alias: "i",
|
|
6371
6373
|
describe: "Input file",
|