@osdk/maker 0.14.0-beta.11 → 0.14.0-beta.13
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 +21 -0
- package/build/browser/api/code-snippets/createCodeSnippets.js +7 -4
- package/build/browser/api/code-snippets/createCodeSnippets.js.map +1 -1
- package/build/browser/api/code-snippets/snippetTypes.js +1 -0
- package/build/browser/api/code-snippets/snippetTypes.js.map +1 -1
- package/build/browser/api/properties/PropertyTypeType.js.map +1 -1
- package/build/browser/api/test/spt.test.js +204 -105
- package/build/browser/api/test/spt.test.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +19 -7
- package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/cjs/index.cjs +27 -11
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +11 -4
- package/build/esm/api/code-snippets/createCodeSnippets.js +7 -4
- package/build/esm/api/code-snippets/createCodeSnippets.js.map +1 -1
- package/build/esm/api/code-snippets/snippetTypes.js +1 -0
- package/build/esm/api/code-snippets/snippetTypes.js.map +1 -1
- package/build/esm/api/properties/PropertyTypeType.js.map +1 -1
- package/build/esm/api/test/spt.test.js +204 -105
- package/build/esm/api/test/spt.test.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +19 -7
- package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
- package/build/types/api/code-snippets/createCodeSnippets.d.ts.map +1 -1
- package/build/types/api/code-snippets/snippetTypes.d.ts +1 -0
- package/build/types/api/code-snippets/snippetTypes.d.ts.map +1 -1
- package/build/types/api/properties/PropertyTypeType.d.ts +11 -4
- package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
import { distributeTypeHelper } from "../toConjure/distributeTypeHelper.js";
|
|
18
18
|
export function propertyTypeTypeToOntologyIrType(type) {
|
|
19
19
|
switch (true) {
|
|
20
|
-
case typeof type === "object" && "
|
|
20
|
+
case typeof type === "object" && type.type === "marking":
|
|
21
21
|
return {
|
|
22
22
|
"type": "marking",
|
|
23
23
|
marking: {
|
|
24
24
|
markingType: type.markingType
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
case typeof type === "object" && "
|
|
27
|
+
case typeof type === "object" && type.type === "struct":
|
|
28
28
|
const structFields = new Array();
|
|
29
29
|
for (const key in type.structDefinition) {
|
|
30
30
|
const fieldTypeDefinition = type.structDefinition[key];
|
|
@@ -71,15 +71,24 @@ export function propertyTypeTypeToOntologyIrType(type) {
|
|
|
71
71
|
structFields
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
case typeof type === "object" && "
|
|
74
|
+
case typeof type === "object" && type.type === "string":
|
|
75
75
|
return {
|
|
76
76
|
"type": "string",
|
|
77
77
|
"string": {
|
|
78
78
|
analyzerOverride: undefined,
|
|
79
|
-
enableAsciiFolding:
|
|
80
|
-
isLongText: type.isLongText,
|
|
81
|
-
supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard,
|
|
82
|
-
supportsExactMatching: type.supportsExactMatching
|
|
79
|
+
enableAsciiFolding: type.enableAsciiFolding,
|
|
80
|
+
isLongText: type.isLongText ?? false,
|
|
81
|
+
supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard ?? false,
|
|
82
|
+
supportsExactMatching: type.supportsExactMatching ?? true,
|
|
83
|
+
supportsFullTextRegex: type.supportsFullTextRegex
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
case typeof type === "object" && type.type === "decimal":
|
|
87
|
+
return {
|
|
88
|
+
"type": "decimal",
|
|
89
|
+
"decimal": {
|
|
90
|
+
precision: type.precision,
|
|
91
|
+
scale: type.scale
|
|
83
92
|
}
|
|
84
93
|
};
|
|
85
94
|
case type === "geopoint":
|
|
@@ -118,6 +127,9 @@ export function propertyTypeTypeToOntologyIrType(type) {
|
|
|
118
127
|
};
|
|
119
128
|
default:
|
|
120
129
|
// use helper function to distribute `type` properly
|
|
130
|
+
if (typeof type === "object") {
|
|
131
|
+
throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);
|
|
132
|
+
}
|
|
121
133
|
return distributeTypeHelper(type);
|
|
122
134
|
}
|
|
123
135
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTypeTypeToOntologyIrType.js","names":["distributeTypeHelper","propertyTypeTypeToOntologyIrType","type","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","field","apiName","displayMetadata","displayName","description","undefined","typeClasses","aliases","fieldType","push","struct","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","
|
|
1
|
+
{"version":3,"file":"propertyTypeTypeToOntologyIrType.js","names":["distributeTypeHelper","propertyTypeTypeToOntologyIrType","type","marking","markingType","structFields","Array","key","structDefinition","fieldTypeDefinition","field","apiName","displayMetadata","displayName","description","undefined","typeClasses","aliases","fieldType","push","struct","analyzerOverride","enableAsciiFolding","isLongText","supportsEfficientLeadingWildcard","supportsExactMatching","supportsFullTextRegex","precision","scale","geohash","mediaReference","geotimeSeriesReference","Error","JSON","stringify"],"sources":["propertyTypeTypeToOntologyIrType.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n OntologyIrStructFieldType,\n OntologyIrType,\n} from \"@osdk/client.unstable\";\nimport type { PropertyTypeType } from \"../../api/properties/PropertyTypeType.js\";\nimport { distributeTypeHelper } from \"../toConjure/distributeTypeHelper.js\";\n\nexport function propertyTypeTypeToOntologyIrType(\n type: PropertyTypeType,\n): OntologyIrType {\n switch (true) {\n case (typeof type === \"object\" && type.type === \"marking\"):\n return {\n \"type\": \"marking\",\n marking: { markingType: type.markingType },\n };\n\n case (typeof type === \"object\" && type.type === \"struct\"):\n const structFields: Array<OntologyIrStructFieldType> = new Array();\n for (const key in type.structDefinition) {\n const fieldTypeDefinition = type.structDefinition[key];\n let field: OntologyIrStructFieldType;\n if (typeof fieldTypeDefinition === \"string\") {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition),\n };\n } else {\n // If it is a full form type definition then process it as such\n if (\"fieldType\" in fieldTypeDefinition) {\n field = {\n ...fieldTypeDefinition,\n apiName: key,\n fieldType: propertyTypeTypeToOntologyIrType(\n fieldTypeDefinition.fieldType,\n ),\n typeClasses: fieldTypeDefinition.typeClasses ?? [],\n aliases: fieldTypeDefinition.aliases ?? [],\n };\n } else {\n field = {\n apiName: key,\n displayMetadata: { displayName: key, description: undefined },\n typeClasses: [],\n aliases: [],\n fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition),\n };\n }\n }\n\n structFields.push(field);\n }\n\n return {\n type: \"struct\",\n struct: { structFields },\n };\n\n case (typeof type === \"object\" && type.type === \"string\"):\n return {\n \"type\": \"string\",\n \"string\": {\n analyzerOverride: undefined,\n enableAsciiFolding: type.enableAsciiFolding,\n isLongText: type.isLongText ?? false,\n supportsEfficientLeadingWildcard:\n type.supportsEfficientLeadingWildcard ?? false,\n supportsExactMatching: type.supportsExactMatching ?? true,\n supportsFullTextRegex: type.supportsFullTextRegex,\n },\n };\n\n case (typeof type === \"object\" && type.type === \"decimal\"):\n return {\n \"type\": \"decimal\",\n \"decimal\": {\n precision: type.precision,\n scale: type.scale,\n },\n };\n\n case (type === \"geopoint\"):\n return { type: \"geohash\", geohash: {} };\n\n case (type === \"decimal\"):\n return { type, [type]: { precision: undefined, scale: undefined } };\n\n case (type === \"string\"):\n return {\n type,\n [type]: {\n analyzerOverride: undefined,\n enableAsciiFolding: undefined,\n isLongText: false,\n supportsEfficientLeadingWildcard: false,\n supportsExactMatching: true,\n },\n };\n\n case (type === \"mediaReference\"):\n return {\n type: type,\n mediaReference: {},\n };\n\n case (type === \"geotimeSeries\"):\n return {\n type: \"geotimeSeriesReference\",\n geotimeSeriesReference: {},\n };\n\n default:\n // use helper function to distribute `type` properly\n if (typeof type === \"object\") {\n throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);\n }\n return distributeTypeHelper(type);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,oBAAoB,QAAQ,sCAAsC;AAE3E,OAAO,SAASC,gCAAgCA,CAC9CC,IAAsB,EACN;EAChB,QAAQ,IAAI;IACV,KAAM,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,SAAS;MACvD,OAAO;QACL,MAAM,EAAE,SAAS;QACjBC,OAAO,EAAE;UAAEC,WAAW,EAAEF,IAAI,CAACE;QAAY;MAC3C,CAAC;IAEH,KAAM,OAAOF,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACA,IAAI,KAAK,QAAQ;MACtD,MAAMG,YAA8C,GAAG,IAAIC,KAAK,CAAC,CAAC;MAClE,KAAK,MAAMC,GAAG,IAAIL,IAAI,CAACM,gBAAgB,EAAE;QACvC,MAAMC,mBAAmB,GAAGP,IAAI,CAACM,gBAAgB,CAACD,GAAG,CAAC;QACtD,IAAIG,KAAgC;QACpC,IAAI,OAAOD,mBAAmB,KAAK,QAAQ,EAAE;UAC3CC,KAAK,GAAG;YACNC,OAAO,EAAEJ,GAAG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]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -785,14 +785,14 @@ function distributeTypeHelper(type) {
|
|
|
785
785
|
// src/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.ts
|
|
786
786
|
function propertyTypeTypeToOntologyIrType(type) {
|
|
787
787
|
switch (true) {
|
|
788
|
-
case (typeof type === "object" && "
|
|
788
|
+
case (typeof type === "object" && type.type === "marking"):
|
|
789
789
|
return {
|
|
790
790
|
"type": "marking",
|
|
791
791
|
marking: {
|
|
792
792
|
markingType: type.markingType
|
|
793
793
|
}
|
|
794
794
|
};
|
|
795
|
-
case (typeof type === "object" && "
|
|
795
|
+
case (typeof type === "object" && type.type === "struct"):
|
|
796
796
|
const structFields = new Array();
|
|
797
797
|
for (const key in type.structDefinition) {
|
|
798
798
|
const fieldTypeDefinition = type.structDefinition[key];
|
|
@@ -838,15 +838,24 @@ function propertyTypeTypeToOntologyIrType(type) {
|
|
|
838
838
|
structFields
|
|
839
839
|
}
|
|
840
840
|
};
|
|
841
|
-
case (typeof type === "object" && "
|
|
841
|
+
case (typeof type === "object" && type.type === "string"):
|
|
842
842
|
return {
|
|
843
843
|
"type": "string",
|
|
844
844
|
"string": {
|
|
845
845
|
analyzerOverride: void 0,
|
|
846
|
-
enableAsciiFolding:
|
|
847
|
-
isLongText: type.isLongText,
|
|
848
|
-
supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard,
|
|
849
|
-
supportsExactMatching: type.supportsExactMatching
|
|
846
|
+
enableAsciiFolding: type.enableAsciiFolding,
|
|
847
|
+
isLongText: type.isLongText ?? false,
|
|
848
|
+
supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard ?? false,
|
|
849
|
+
supportsExactMatching: type.supportsExactMatching ?? true,
|
|
850
|
+
supportsFullTextRegex: type.supportsFullTextRegex
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
case (typeof type === "object" && type.type === "decimal"):
|
|
854
|
+
return {
|
|
855
|
+
"type": "decimal",
|
|
856
|
+
"decimal": {
|
|
857
|
+
precision: type.precision,
|
|
858
|
+
scale: type.scale
|
|
850
859
|
}
|
|
851
860
|
};
|
|
852
861
|
case type === "geopoint":
|
|
@@ -884,6 +893,9 @@ function propertyTypeTypeToOntologyIrType(type) {
|
|
|
884
893
|
geotimeSeriesReference: {}
|
|
885
894
|
};
|
|
886
895
|
default:
|
|
896
|
+
if (typeof type === "object") {
|
|
897
|
+
throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);
|
|
898
|
+
}
|
|
887
899
|
return distributeTypeHelper(type);
|
|
888
900
|
}
|
|
889
901
|
}
|
|
@@ -1473,6 +1485,7 @@ var objectSnippets = /* @__PURE__ */ (function(objectSnippets2) {
|
|
|
1473
1485
|
objectSnippets2[objectSnippets2["subscribeToObjectSetInstructions"] = 8] = "subscribeToObjectSetInstructions";
|
|
1474
1486
|
return objectSnippets2;
|
|
1475
1487
|
})({});
|
|
1488
|
+
var snippetNameMapping = /* @__PURE__ */ new Map([["loadInterfaceMetadataSnippet", "Load {{interfaceName}} metadata"], ["loadInterfacesReference", "Load pages of {{interfaceName}}"], ["loadAllInterfacesReference", "Load all {{interfaceName}}"], ["loadOrderedInterfacesReference", "Load ordered {{interfaceName}}"], ["searchInterfacesReference", "Filtering"], ["subscribeToObjectSetInstructions", "Subscribe to object sets"]]);
|
|
1476
1489
|
|
|
1477
1490
|
// src/api/code-snippets/createCodeSnippets.ts
|
|
1478
1491
|
function createCodeSnippets(ontology, packageName, outputDir) {
|
|
@@ -1514,7 +1527,8 @@ function generateInterfaceSnippet(interfaceType, packageName) {
|
|
|
1514
1527
|
"interfaceApiName": interfaceType.apiName,
|
|
1515
1528
|
"packageName": packageName,
|
|
1516
1529
|
"objectOrInterfaceApiName": interfaceType.apiName,
|
|
1517
|
-
"propertyNames": Object.keys(interfaceType.propertiesV2)
|
|
1530
|
+
"propertyNames": Object.keys(interfaceType.propertiesV2),
|
|
1531
|
+
"interfaceName": interfaceType.displayMetadata.displayName
|
|
1518
1532
|
};
|
|
1519
1533
|
return getSnippets(interfaceSnippets, interfaceContext);
|
|
1520
1534
|
}
|
|
@@ -1536,9 +1550,11 @@ function generateActionSnippet(actionType, packageName) {
|
|
|
1536
1550
|
function getSnippets(snippetType, context) {
|
|
1537
1551
|
const allSnippets = {};
|
|
1538
1552
|
for (const templateName of Object.keys(snippetType).filter((key) => isNaN(Number(key)))) {
|
|
1539
|
-
const
|
|
1553
|
+
const versions = Object.values(typescriptSdkDocs.TYPESCRIPT_OSDK_SNIPPETS.versions);
|
|
1554
|
+
const latestTemplate = versions.slice().reverse().find((v) => v.snippets[templateName])?.snippets[templateName].at(-1)?.template ?? "";
|
|
1540
1555
|
const renderedTemplate = Mustache__default.default.render(latestTemplate, context);
|
|
1541
|
-
|
|
1556
|
+
const snippetName = snippetNameMapping.get(templateName);
|
|
1557
|
+
allSnippets[snippetName !== void 0 ? Mustache__default.default.render(snippetName, context) : templateName] = renderedTemplate;
|
|
1542
1558
|
}
|
|
1543
1559
|
return allSnippets;
|
|
1544
1560
|
}
|
|
@@ -2025,7 +2041,7 @@ function addNamespaceIfNone(apiName) {
|
|
|
2025
2041
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
2026
2042
|
var uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
2027
2043
|
async function main(args = process.argv) {
|
|
2028
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.14.0-beta.
|
|
2044
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.14.0-beta.13").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
2029
2045
|
input: {
|
|
2030
2046
|
alias: "i",
|
|
2031
2047
|
describe: "Input file",
|