@osdk/maker-import 0.1.0
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/bin/maker-import.mjs +6 -0
- package/build/browser/cli/main.js +47 -0
- package/build/browser/cli/main.js.map +1 -0
- package/build/browser/generate/convertActionType.js +63 -0
- package/build/browser/generate/convertActionType.js.map +1 -0
- package/build/browser/generate/convertInterfaceType.js +74 -0
- package/build/browser/generate/convertInterfaceType.js.map +1 -0
- package/build/browser/generate/convertObjectType.js +64 -0
- package/build/browser/generate/convertObjectType.js.map +1 -0
- package/build/browser/generate/convertSharedPropertyType.js +37 -0
- package/build/browser/generate/convertSharedPropertyType.js.map +1 -0
- package/build/browser/generate/mapActionParameterType.js +211 -0
- package/build/browser/generate/mapActionParameterType.js.map +1 -0
- package/build/browser/generate/mapPropertyType.js +117 -0
- package/build/browser/generate/mapPropertyType.js.map +1 -0
- package/build/browser/generate/utils.js +52 -0
- package/build/browser/generate/utils.js.map +1 -0
- package/build/browser/generate/writeImportedOntology.js +169 -0
- package/build/browser/generate/writeImportedOntology.js.map +1 -0
- package/build/browser/index.js +19 -0
- package/build/browser/index.js.map +1 -0
- package/build/cjs/index.cjs +601 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +88 -0
- package/build/esm/cli/main.js +47 -0
- package/build/esm/cli/main.js.map +1 -0
- package/build/esm/generate/convertActionType.js +63 -0
- package/build/esm/generate/convertActionType.js.map +1 -0
- package/build/esm/generate/convertInterfaceType.js +74 -0
- package/build/esm/generate/convertInterfaceType.js.map +1 -0
- package/build/esm/generate/convertObjectType.js +64 -0
- package/build/esm/generate/convertObjectType.js.map +1 -0
- package/build/esm/generate/convertSharedPropertyType.js +37 -0
- package/build/esm/generate/convertSharedPropertyType.js.map +1 -0
- package/build/esm/generate/mapActionParameterType.js +211 -0
- package/build/esm/generate/mapActionParameterType.js.map +1 -0
- package/build/esm/generate/mapPropertyType.js +117 -0
- package/build/esm/generate/mapPropertyType.js.map +1 -0
- package/build/esm/generate/utils.js +52 -0
- package/build/esm/generate/utils.js.map +1 -0
- package/build/esm/generate/writeImportedOntology.js +169 -0
- package/build/esm/generate/writeImportedOntology.js.map +1 -0
- package/build/esm/index.js +19 -0
- package/build/esm/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { consola } from "consola";
|
|
18
|
+
|
|
19
|
+
// ActionParameterType from maker is not exported, so we use structural typing.
|
|
20
|
+
// The generated JSON will have the correct shape at runtime.
|
|
21
|
+
|
|
22
|
+
const SIMPLE_PARAM_TYPES = {
|
|
23
|
+
string: "string",
|
|
24
|
+
integer: "integer",
|
|
25
|
+
boolean: "boolean",
|
|
26
|
+
double: "double",
|
|
27
|
+
long: "long",
|
|
28
|
+
date: "date",
|
|
29
|
+
timestamp: "timestamp",
|
|
30
|
+
attachment: "attachment",
|
|
31
|
+
marking: "marking",
|
|
32
|
+
geohash: "geohash",
|
|
33
|
+
geoshape: "geoshape",
|
|
34
|
+
mediaReference: "mediaReference",
|
|
35
|
+
decimal: "decimal"
|
|
36
|
+
};
|
|
37
|
+
const LIST_VARIANT_MAP = {
|
|
38
|
+
string: "stringList",
|
|
39
|
+
integer: "integerList",
|
|
40
|
+
boolean: "booleanList",
|
|
41
|
+
double: "doubleList",
|
|
42
|
+
long: "longList",
|
|
43
|
+
date: "dateList",
|
|
44
|
+
timestamp: "timestampList",
|
|
45
|
+
attachment: "attachmentList",
|
|
46
|
+
marking: "markingList",
|
|
47
|
+
geohash: "geohashList",
|
|
48
|
+
geoshape: "geoshapeList",
|
|
49
|
+
mediaReference: "mediaReferenceList",
|
|
50
|
+
decimal: "decimalList"
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Maps gateway struct field types to OntologyIrStructFieldBaseParameterType format
|
|
54
|
+
const STRUCT_FIELD_IR_TYPES = {
|
|
55
|
+
boolean: "boolean",
|
|
56
|
+
integer: "integer",
|
|
57
|
+
long: "long",
|
|
58
|
+
double: "double",
|
|
59
|
+
string: "string",
|
|
60
|
+
geohash: "geohash",
|
|
61
|
+
geoshape: "geoshape",
|
|
62
|
+
timestamp: "timestamp",
|
|
63
|
+
date: "date"
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Converts gateway struct field types to the IR structFieldTypes record.
|
|
68
|
+
* Returns undefined if structFieldTypes is missing.
|
|
69
|
+
*/
|
|
70
|
+
function mapGatewayStructFieldsToIr(dataType) {
|
|
71
|
+
const fields = dataType.structFieldTypes;
|
|
72
|
+
if (!fields) {
|
|
73
|
+
consola.warn("Struct parameter type missing structFieldTypes, skipping");
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
const structFieldTypes = {};
|
|
77
|
+
for (const field of fields) {
|
|
78
|
+
const fieldType = field.dataType.type;
|
|
79
|
+
const irType = STRUCT_FIELD_IR_TYPES[fieldType];
|
|
80
|
+
if (irType) {
|
|
81
|
+
structFieldTypes[field.apiName] = {
|
|
82
|
+
type: irType,
|
|
83
|
+
[irType]: {}
|
|
84
|
+
};
|
|
85
|
+
} else if (fieldType === "object") {
|
|
86
|
+
const objectTypeApiName = field.dataType.objectTypeApiName ?? "";
|
|
87
|
+
structFieldTypes[field.apiName] = {
|
|
88
|
+
type: "objectReference",
|
|
89
|
+
objectReference: {
|
|
90
|
+
objectTypeId: objectTypeApiName
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
} else {
|
|
94
|
+
consola.warn(`Skipping struct param field "${field.apiName}": unsupported type "${fieldType}"`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return structFieldTypes;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Maps a gateway ActionParameterType (discriminated union from OntologyFullMetadata)
|
|
102
|
+
* to a maker ActionParameterType (string primitives or complex objects).
|
|
103
|
+
*
|
|
104
|
+
* Returns undefined for unsupported types (with a warning).
|
|
105
|
+
*/
|
|
106
|
+
export function mapActionParameterType(dataType) {
|
|
107
|
+
const simpleType = SIMPLE_PARAM_TYPES[dataType.type];
|
|
108
|
+
if (simpleType !== undefined) {
|
|
109
|
+
return simpleType;
|
|
110
|
+
}
|
|
111
|
+
switch (dataType.type) {
|
|
112
|
+
case "object":
|
|
113
|
+
{
|
|
114
|
+
const objectTypeApiName = dataType.objectTypeApiName ?? "";
|
|
115
|
+
return {
|
|
116
|
+
type: "objectReference",
|
|
117
|
+
objectReference: {
|
|
118
|
+
objectTypeId: objectTypeApiName
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
case "objectSet":
|
|
123
|
+
{
|
|
124
|
+
const objectTypeApiName = dataType.objectTypeApiName ?? "";
|
|
125
|
+
return {
|
|
126
|
+
type: "objectSetRid",
|
|
127
|
+
objectSetRid: {
|
|
128
|
+
objectTypeId: objectTypeApiName
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
case "interfaceObject":
|
|
133
|
+
{
|
|
134
|
+
const interfaceApiName = dataType.interfaceApiName ?? "";
|
|
135
|
+
return {
|
|
136
|
+
type: "interfaceReference",
|
|
137
|
+
interfaceReference: {
|
|
138
|
+
interfaceTypeRid: interfaceApiName
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
case "array":
|
|
143
|
+
{
|
|
144
|
+
const subType = dataType.subType;
|
|
145
|
+
if (!subType) {
|
|
146
|
+
consola.warn("Array parameter type missing subType, skipping");
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// For simple types, use the list variant
|
|
151
|
+
const listVariant = LIST_VARIANT_MAP[subType.type];
|
|
152
|
+
if (listVariant !== undefined) {
|
|
153
|
+
return listVariant;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// For object references, use objectReferenceList
|
|
157
|
+
if (subType.type === "object") {
|
|
158
|
+
const objectTypeApiName = subType.objectTypeApiName ?? "";
|
|
159
|
+
return {
|
|
160
|
+
type: "objectReferenceList",
|
|
161
|
+
objectReferenceList: {
|
|
162
|
+
objectTypeId: objectTypeApiName
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// For interface references, use interfaceReferenceList
|
|
168
|
+
if (subType.type === "interfaceObject") {
|
|
169
|
+
const interfaceApiName = subType.interfaceApiName ?? "";
|
|
170
|
+
return {
|
|
171
|
+
type: "interfaceReferenceList",
|
|
172
|
+
interfaceReferenceList: {
|
|
173
|
+
interfaceTypeRid: interfaceApiName
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (subType.type === "struct") {
|
|
178
|
+
const structFields = mapGatewayStructFieldsToIr(subType);
|
|
179
|
+
if (!structFields) return undefined;
|
|
180
|
+
return {
|
|
181
|
+
type: "structList",
|
|
182
|
+
structList: {
|
|
183
|
+
structFieldTypes: structFields
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
consola.warn(`Skipping array parameter with unsupported subType: ${subType.type}`);
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
case "struct":
|
|
191
|
+
{
|
|
192
|
+
const structFields = mapGatewayStructFieldsToIr(dataType);
|
|
193
|
+
if (!structFields) return undefined;
|
|
194
|
+
return {
|
|
195
|
+
type: "struct",
|
|
196
|
+
struct: {
|
|
197
|
+
structFieldTypes: structFields
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
case "vector":
|
|
202
|
+
consola.warn("Skipping vector parameter type: no maker equivalent");
|
|
203
|
+
return undefined;
|
|
204
|
+
case "objectType":
|
|
205
|
+
return "objectTypeReference";
|
|
206
|
+
default:
|
|
207
|
+
consola.warn(`Skipping unknown parameter type: ${dataType.type}`);
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=mapActionParameterType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapActionParameterType.js","names":["consola","SIMPLE_PARAM_TYPES","string","integer","boolean","double","long","date","timestamp","attachment","marking","geohash","geoshape","mediaReference","decimal","LIST_VARIANT_MAP","STRUCT_FIELD_IR_TYPES","mapGatewayStructFieldsToIr","dataType","fields","structFieldTypes","warn","undefined","field","fieldType","type","irType","apiName","objectTypeApiName","objectReference","objectTypeId","mapActionParameterType","simpleType","objectSetRid","interfaceApiName","interfaceReference","interfaceTypeRid","subType","listVariant","objectReferenceList","interfaceReferenceList","structFields","structList","struct"],"sources":["mapActionParameterType.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 { consola } from \"consola\";\n\n// ActionParameterType from maker is not exported, so we use structural typing.\n// The generated JSON will have the correct shape at runtime.\ntype ActionParameterType = string | { type: string; [key: string]: unknown };\n\nconst SIMPLE_PARAM_TYPES: Record<string, ActionParameterType> = {\n string: \"string\",\n integer: \"integer\",\n boolean: \"boolean\",\n double: \"double\",\n long: \"long\",\n date: \"date\",\n timestamp: \"timestamp\",\n attachment: \"attachment\",\n marking: \"marking\",\n geohash: \"geohash\",\n geoshape: \"geoshape\",\n mediaReference: \"mediaReference\",\n decimal: \"decimal\",\n};\n\nconst LIST_VARIANT_MAP: Record<string, ActionParameterType> = {\n string: \"stringList\",\n integer: \"integerList\",\n boolean: \"booleanList\",\n double: \"doubleList\",\n long: \"longList\",\n date: \"dateList\",\n timestamp: \"timestampList\",\n attachment: \"attachmentList\",\n marking: \"markingList\",\n geohash: \"geohashList\",\n geoshape: \"geoshapeList\",\n mediaReference: \"mediaReferenceList\",\n decimal: \"decimalList\",\n};\n\n// Maps gateway struct field types to OntologyIrStructFieldBaseParameterType format\nconst STRUCT_FIELD_IR_TYPES: Record<string, string> = {\n boolean: \"boolean\",\n integer: \"integer\",\n long: \"long\",\n double: \"double\",\n string: \"string\",\n geohash: \"geohash\",\n geoshape: \"geoshape\",\n timestamp: \"timestamp\",\n date: \"date\",\n};\n\n/**\n * Converts gateway struct field types to the IR structFieldTypes record.\n * Returns undefined if structFieldTypes is missing.\n */\nfunction mapGatewayStructFieldsToIr(\n dataType: { type: string; [key: string]: unknown },\n): Record<string, { type: string; [key: string]: unknown }> | undefined {\n const fields = (dataType as {\n structFieldTypes?: Array<{\n apiName: string;\n dataType: { type: string; [key: string]: unknown };\n }>;\n }).structFieldTypes;\n if (!fields) {\n consola.warn(\"Struct parameter type missing structFieldTypes, skipping\");\n return undefined;\n }\n const structFieldTypes: Record<\n string,\n { type: string; [key: string]: unknown }\n > = {};\n for (const field of fields) {\n const fieldType = field.dataType.type;\n const irType = STRUCT_FIELD_IR_TYPES[fieldType];\n if (irType) {\n structFieldTypes[field.apiName] = { type: irType, [irType]: {} };\n } else if (fieldType === \"object\") {\n const objectTypeApiName =\n (field.dataType as { objectTypeApiName?: string }).objectTypeApiName\n ?? \"\";\n structFieldTypes[field.apiName] = {\n type: \"objectReference\",\n objectReference: { objectTypeId: objectTypeApiName },\n };\n } else {\n consola.warn(\n `Skipping struct param field \"${field.apiName}\": unsupported type \"${fieldType}\"`,\n );\n }\n }\n return structFieldTypes;\n}\n\n/**\n * Maps a gateway ActionParameterType (discriminated union from OntologyFullMetadata)\n * to a maker ActionParameterType (string primitives or complex objects).\n *\n * Returns undefined for unsupported types (with a warning).\n */\nexport function mapActionParameterType(\n dataType: { type: string; [key: string]: unknown },\n): ActionParameterType | undefined {\n const simpleType = SIMPLE_PARAM_TYPES[dataType.type];\n if (simpleType !== undefined) {\n return simpleType;\n }\n\n switch (dataType.type) {\n case \"object\": {\n const objectTypeApiName =\n (dataType as { objectTypeApiName?: string }).objectTypeApiName ?? \"\";\n return {\n type: \"objectReference\",\n objectReference: { objectTypeId: objectTypeApiName },\n };\n }\n case \"objectSet\": {\n const objectTypeApiName =\n (dataType as { objectTypeApiName?: string }).objectTypeApiName ?? \"\";\n return {\n type: \"objectSetRid\",\n objectSetRid: { objectTypeId: objectTypeApiName },\n };\n }\n case \"interfaceObject\": {\n const interfaceApiName =\n (dataType as { interfaceApiName?: string }).interfaceApiName ?? \"\";\n return {\n type: \"interfaceReference\",\n interfaceReference: { interfaceTypeRid: interfaceApiName },\n };\n }\n case \"array\": {\n const subType = (dataType as { subType?: { type: string } }).subType;\n if (!subType) {\n consola.warn(\"Array parameter type missing subType, skipping\");\n return undefined;\n }\n\n // For simple types, use the list variant\n const listVariant = LIST_VARIANT_MAP[subType.type];\n if (listVariant !== undefined) {\n return listVariant;\n }\n\n // For object references, use objectReferenceList\n if (subType.type === \"object\") {\n const objectTypeApiName =\n (subType as { objectTypeApiName?: string }).objectTypeApiName ?? \"\";\n return {\n type: \"objectReferenceList\",\n objectReferenceList: { objectTypeId: objectTypeApiName },\n };\n }\n\n // For interface references, use interfaceReferenceList\n if (subType.type === \"interfaceObject\") {\n const interfaceApiName =\n (subType as { interfaceApiName?: string }).interfaceApiName ?? \"\";\n return {\n type: \"interfaceReferenceList\",\n interfaceReferenceList: { interfaceTypeRid: interfaceApiName },\n };\n }\n\n if (subType.type === \"struct\") {\n const structFields = mapGatewayStructFieldsToIr(\n subType as { type: string; [key: string]: unknown },\n );\n if (!structFields) return undefined;\n return {\n type: \"structList\",\n structList: { structFieldTypes: structFields },\n };\n }\n\n consola.warn(\n `Skipping array parameter with unsupported subType: ${subType.type}`,\n );\n return undefined;\n }\n case \"struct\": {\n const structFields = mapGatewayStructFieldsToIr(dataType);\n if (!structFields) return undefined;\n return {\n type: \"struct\",\n struct: { structFieldTypes: structFields },\n };\n }\n case \"vector\":\n consola.warn(\"Skipping vector parameter type: no maker equivalent\");\n return undefined;\n case \"objectType\":\n return \"objectTypeReference\";\n default:\n consola.warn(`Skipping unknown parameter type: ${dataType.type}`);\n return undefined;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,SAAS;;AAEjC;AACA;;AAGA,MAAMC,kBAAuD,GAAG;EAC9DC,MAAM,EAAE,QAAQ;EAChBC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,SAAS,EAAE,WAAW;EACtBC,UAAU,EAAE,YAAY;EACxBC,OAAO,EAAE,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,UAAU;EACpBC,cAAc,EAAE,gBAAgB;EAChCC,OAAO,EAAE;AACX,CAAC;AAED,MAAMC,gBAAqD,GAAG;EAC5Db,MAAM,EAAE,YAAY;EACpBC,OAAO,EAAE,aAAa;EACtBC,OAAO,EAAE,aAAa;EACtBC,MAAM,EAAE,YAAY;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CAACqB,IAAI,CAAC,qDAAqD,CAAC;MACnE,OAAOC,SAAS;IAClB,KAAK,YAAY;MACf,OAAO,qBAAqB;IAC9B;MACEtB,OAAO,CAACqB,IAAI,CAAC,oCAAoCH,QAAQ,CAACO,IAAI,EAAE,CAAC;MACjE,OAAOH,SAAS;EACpB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { consola } from "consola";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Result of mapping a gateway ObjectPropertyType to a maker PropertyTypeType.
|
|
21
|
+
* `array` is true when the gateway type was {type: "array", subType: X}.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Maps a gateway ObjectPropertyType (discriminated union with {type: string})
|
|
26
|
+
* to a maker PropertyTypeType.
|
|
27
|
+
*
|
|
28
|
+
* Returns undefined for unsupported types (with a warning).
|
|
29
|
+
*/
|
|
30
|
+
export function mapPropertyType(dataType) {
|
|
31
|
+
switch (dataType.type) {
|
|
32
|
+
case "string":
|
|
33
|
+
return {
|
|
34
|
+
type: "string"
|
|
35
|
+
};
|
|
36
|
+
case "integer":
|
|
37
|
+
return {
|
|
38
|
+
type: "integer"
|
|
39
|
+
};
|
|
40
|
+
case "boolean":
|
|
41
|
+
return {
|
|
42
|
+
type: "boolean"
|
|
43
|
+
};
|
|
44
|
+
case "double":
|
|
45
|
+
return {
|
|
46
|
+
type: "double"
|
|
47
|
+
};
|
|
48
|
+
case "float":
|
|
49
|
+
return {
|
|
50
|
+
type: "float"
|
|
51
|
+
};
|
|
52
|
+
case "long":
|
|
53
|
+
return {
|
|
54
|
+
type: "long"
|
|
55
|
+
};
|
|
56
|
+
case "short":
|
|
57
|
+
return {
|
|
58
|
+
type: "short"
|
|
59
|
+
};
|
|
60
|
+
case "byte":
|
|
61
|
+
return {
|
|
62
|
+
type: "byte"
|
|
63
|
+
};
|
|
64
|
+
case "date":
|
|
65
|
+
return {
|
|
66
|
+
type: "date"
|
|
67
|
+
};
|
|
68
|
+
case "timestamp":
|
|
69
|
+
return {
|
|
70
|
+
type: "timestamp"
|
|
71
|
+
};
|
|
72
|
+
case "decimal":
|
|
73
|
+
return {
|
|
74
|
+
type: "decimal"
|
|
75
|
+
};
|
|
76
|
+
case "attachment":
|
|
77
|
+
return {
|
|
78
|
+
type: "attachment"
|
|
79
|
+
};
|
|
80
|
+
case "geopoint":
|
|
81
|
+
return {
|
|
82
|
+
type: "geopoint"
|
|
83
|
+
};
|
|
84
|
+
case "geoshape":
|
|
85
|
+
return {
|
|
86
|
+
type: "geoshape"
|
|
87
|
+
};
|
|
88
|
+
case "mediaReference":
|
|
89
|
+
return {
|
|
90
|
+
type: "mediaReference"
|
|
91
|
+
};
|
|
92
|
+
case "geotimeSeriesReference":
|
|
93
|
+
return {
|
|
94
|
+
type: "geotimeSeries"
|
|
95
|
+
};
|
|
96
|
+
case "array":
|
|
97
|
+
{
|
|
98
|
+
const subType = dataType.subType;
|
|
99
|
+
if (!subType) {
|
|
100
|
+
consola.warn("Array type missing subType, skipping");
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const inner = mapPropertyType(subType);
|
|
104
|
+
if (!inner) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
type: inner.type,
|
|
109
|
+
array: true
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
// We don't support structs or markings here. It should have no influence on importing functionality
|
|
113
|
+
default:
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=mapPropertyType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapPropertyType.js","names":["consola","mapPropertyType","dataType","type","subType","warn","undefined","inner","array"],"sources":["mapPropertyType.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 { PropertyTypeType } from \"@osdk/maker\";\nimport { consola } from \"consola\";\n\n/**\n * Result of mapping a gateway ObjectPropertyType to a maker PropertyTypeType.\n * `array` is true when the gateway type was {type: \"array\", subType: X}.\n */\nexport interface MappedPropertyType {\n type: PropertyTypeType;\n array?: boolean;\n}\n\n/**\n * Maps a gateway ObjectPropertyType (discriminated union with {type: string})\n * to a maker PropertyTypeType.\n *\n * Returns undefined for unsupported types (with a warning).\n */\nexport function mapPropertyType(\n dataType: { type: string; [key: string]: unknown },\n): MappedPropertyType | undefined {\n switch (dataType.type) {\n case \"string\":\n return { type: \"string\" };\n case \"integer\":\n return { type: \"integer\" };\n case \"boolean\":\n return { type: \"boolean\" };\n case \"double\":\n return { type: \"double\" };\n case \"float\":\n return { type: \"float\" };\n case \"long\":\n return { type: \"long\" };\n case \"short\":\n return { type: \"short\" };\n case \"byte\":\n return { type: \"byte\" };\n case \"date\":\n return { type: \"date\" };\n case \"timestamp\":\n return { type: \"timestamp\" };\n case \"decimal\":\n return { type: \"decimal\" };\n case \"attachment\":\n return { type: \"attachment\" };\n case \"geopoint\":\n return { type: \"geopoint\" };\n case \"geoshape\":\n return { type: \"geoshape\" };\n case \"mediaReference\":\n return { type: \"mediaReference\" };\n case \"geotimeSeriesReference\":\n return { type: \"geotimeSeries\" };\n case \"array\": {\n const subType = (dataType as { subType?: { type: string } }).subType;\n if (!subType) {\n consola.warn(\"Array type missing subType, skipping\");\n return undefined;\n }\n const inner = mapPropertyType(subType);\n if (!inner) {\n return undefined;\n }\n return { type: inner.type, array: true };\n }\n // We don't support structs or markings here. It should have no influence on importing functionality\n default:\n return undefined;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,OAAO,QAAQ,SAAS;;AAEjC;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,QAAkD,EAClB;EAChC,QAAQA,QAAQ,CAACC,IAAI;IACnB,KAAK,QAAQ;MACX,OAAO;QAAEA,IAAI,EAAE;MAAS,CAAC;IAC3B,KAAK,SAAS;MACZ,OAAO;QAAEA,IAAI,EAAE;MAAU,CAAC;IAC5B,KAAK,SAAS;MACZ,OAAO;QAAEA,IAAI,EAAE;MAAU,CAAC;IAC5B,KAAK,QAAQ;MACX,OAAO;QAAEA,IAAI,EAAE;MAAS,CAAC;IAC3B,KAAK,OAAO;MACV,OAAO;QAAEA,IAAI,EAAE;MAAQ,CAAC;IAC1B,KAAK,MAAM;MACT,OAAO;QAAEA,IAAI,EAAE;MAAO,CAAC;IACzB,KAAK,OAAO;MACV,OAAO;QAAEA,IAAI,EAAE;MAAQ,CAAC;IAC1B,KAAK,MAAM;MACT,OAAO;QAAEA,IAAI,EAAE;MAAO,CAAC;IACzB,KAAK,MAAM;MACT,OAAO;QAAEA,IAAI,EAAE;MAAO,CAAC;IACzB,KAAK,WAAW;MACd,OAAO;QAAEA,IAAI,EAAE;MAAY,CAAC;IAC9B,KAAK,SAAS;MACZ,OAAO;QAAEA,IAAI,EAAE;MAAU,CAAC;IAC5B,KAAK,YAAY;MACf,OAAO;QAAEA,IAAI,EAAE;MAAa,CAAC;IAC/B,KAAK,UAAU;MACb,OAAO;QAAEA,IAAI,EAAE;MAAW,CAAC;IAC7B,KAAK,UAAU;MACb,OAAO;QAAEA,IAAI,EAAE;MAAW,CAAC;IAC7B,KAAK,gBAAgB;MACnB,OAAO;QAAEA,IAAI,EAAE;MAAiB,CAAC;IACnC,KAAK,wBAAwB;MAC3B,OAAO;QAAEA,IAAI,EAAE;MAAgB,CAAC;IAClC,KAAK,OAAO;MAAE;QACZ,MAAMC,OAAO,GAAIF,QAAQ,CAAoCE,OAAO;QACpE,IAAI,CAACA,OAAO,EAAE;UACZJ,OAAO,CAACK,IAAI,CAAC,sCAAsC,CAAC;UACpD,OAAOC,SAAS;QAClB;QACA,MAAMC,KAAK,GAAGN,eAAe,CAACG,OAAO,CAAC;QACtC,IAAI,CAACG,KAAK,EAAE;UACV,OAAOD,SAAS;QAClB;QACA,OAAO;UAAEH,IAAI,EAAEI,KAAK,CAACJ,IAAI;UAAEK,KAAK,EAAE;QAAK,CAAC;MAC1C;IACA;IACA;MACE,OAAOF,SAAS;EACpB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Strips namespace prefix from an apiName.
|
|
19
|
+
* "com.example.Employee" -> "Employee"
|
|
20
|
+
* "Employee" -> "Employee"
|
|
21
|
+
*/
|
|
22
|
+
export function withoutNamespace(apiName) {
|
|
23
|
+
const lastDot = apiName.lastIndexOf(".");
|
|
24
|
+
if (lastDot === -1) {
|
|
25
|
+
return apiName;
|
|
26
|
+
}
|
|
27
|
+
return apiName.substring(lastDot + 1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Converts a dot-separated apiName to camelCase, including namespace segments.
|
|
32
|
+
* "com.example.Employee" -> "comExampleEmployee"
|
|
33
|
+
* "Employee" -> "employee"
|
|
34
|
+
*/
|
|
35
|
+
export function fullCamel(apiName) {
|
|
36
|
+
return camel(apiName.replace(/\./g, "-"));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Converts an apiName to camelCase variable name.
|
|
41
|
+
* "Employee" -> "employee"
|
|
42
|
+
* "create-employee" -> "createEmployee"
|
|
43
|
+
*/
|
|
44
|
+
export function camel(str) {
|
|
45
|
+
if (!str) {
|
|
46
|
+
return str;
|
|
47
|
+
}
|
|
48
|
+
let result = str.replace(/[-_]+(.)?/g, (_, c) => c ? c.toUpperCase() : "");
|
|
49
|
+
result = result.charAt(0).toLowerCase() + result.slice(1);
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["withoutNamespace","apiName","lastDot","lastIndexOf","substring","fullCamel","camel","replace","str","result","_","c","toUpperCase","charAt","toLowerCase","slice"],"sources":["utils.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\n/**\n * Strips namespace prefix from an apiName.\n * \"com.example.Employee\" -> \"Employee\"\n * \"Employee\" -> \"Employee\"\n */\nexport function withoutNamespace(apiName: string): string {\n const lastDot = apiName.lastIndexOf(\".\");\n if (lastDot === -1) {\n return apiName;\n }\n return apiName.substring(lastDot + 1);\n}\n\n/**\n * Converts a dot-separated apiName to camelCase, including namespace segments.\n * \"com.example.Employee\" -> \"comExampleEmployee\"\n * \"Employee\" -> \"employee\"\n */\nexport function fullCamel(apiName: string): string {\n return camel(apiName.replace(/\\./g, \"-\"));\n}\n\n/**\n * Converts an apiName to camelCase variable name.\n * \"Employee\" -> \"employee\"\n * \"create-employee\" -> \"createEmployee\"\n */\nexport function camel(str: string): string {\n if (!str) {\n return str;\n }\n let result = str.replace(/[-_]+(.)?/g, (_, c) => (c ? c.toUpperCase() : \"\"));\n result = result.charAt(0).toLowerCase() + result.slice(1);\n return result;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gBAAgBA,CAACC,OAAe,EAAU;EACxD,MAAMC,OAAO,GAAGD,OAAO,CAACE,WAAW,CAAC,GAAG,CAAC;EACxC,IAAID,OAAO,KAAK,CAAC,CAAC,EAAE;IAClB,OAAOD,OAAO;EAChB;EACA,OAAOA,OAAO,CAACG,SAAS,CAACF,OAAO,GAAG,CAAC,CAAC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,SAASA,CAACJ,OAAe,EAAU;EACjD,OAAOK,KAAK,CAACL,OAAO,CAACM,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASD,KAAKA,CAACE,GAAW,EAAU;EACzC,IAAI,CAACA,GAAG,EAAE;IACR,OAAOA,GAAG;EACZ;EACA,IAAIC,MAAM,GAAGD,GAAG,CAACD,OAAO,CAAC,YAAY,EAAE,CAACG,CAAC,EAAEC,CAAC,KAAMA,CAAC,GAAGA,CAAC,CAACC,WAAW,CAAC,CAAC,GAAG,EAAG,CAAC;EAC5EH,MAAM,GAAGA,MAAM,CAACI,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGL,MAAM,CAACM,KAAK,CAAC,CAAC,CAAC;EACzD,OAAON,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { OntologyEntityTypeEnum } from "@osdk/maker";
|
|
18
|
+
import * as fs from "node:fs";
|
|
19
|
+
import * as path from "node:path";
|
|
20
|
+
import { convertActionType } from "./convertActionType.js";
|
|
21
|
+
import { convertInterfaceType } from "./convertInterfaceType.js";
|
|
22
|
+
import { convertObjectType } from "./convertObjectType.js";
|
|
23
|
+
import { convertSharedPropertyType } from "./convertSharedPropertyType.js";
|
|
24
|
+
import { camel, fullCamel, withoutNamespace } from "./utils.js";
|
|
25
|
+
const TYPE_NAME_MAP = {
|
|
26
|
+
[OntologyEntityTypeEnum.OBJECT_TYPE]: "ObjectType",
|
|
27
|
+
[OntologyEntityTypeEnum.ACTION_TYPE]: "ActionType",
|
|
28
|
+
[OntologyEntityTypeEnum.INTERFACE_TYPE]: "InterfaceType",
|
|
29
|
+
[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: "SharedPropertyType"
|
|
30
|
+
};
|
|
31
|
+
const DIR_NAME_MAP = {
|
|
32
|
+
[OntologyEntityTypeEnum.OBJECT_TYPE]: "object-types",
|
|
33
|
+
[OntologyEntityTypeEnum.ACTION_TYPE]: "action-types",
|
|
34
|
+
[OntologyEntityTypeEnum.INTERFACE_TYPE]: "interface-types",
|
|
35
|
+
[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: "shared-property-types"
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Resolves unique variable/file names for a list of apiNames.
|
|
39
|
+
*
|
|
40
|
+
* First tries the short name (namespace stripped, camelCase).
|
|
41
|
+
* If that collides, all colliding entries are escalated to the full
|
|
42
|
+
* camelCase name (namespace included). Any remaining duplicates get
|
|
43
|
+
* a numeric suffix.
|
|
44
|
+
*/
|
|
45
|
+
export function resolveVarNames(apiNames) {
|
|
46
|
+
const shortNames = apiNames.map(n => camel(withoutNamespace(n)));
|
|
47
|
+
|
|
48
|
+
// Find which short names appear more than once
|
|
49
|
+
const counts = new Map();
|
|
50
|
+
for (const name of shortNames) {
|
|
51
|
+
counts.set(name, (counts.get(name) ?? 0) + 1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Escalate conflicting names to fullCamel
|
|
55
|
+
const resolved = apiNames.map((apiName, i) => {
|
|
56
|
+
if (counts.get(shortNames[i]) > 1) {
|
|
57
|
+
return fullCamel(apiName);
|
|
58
|
+
}
|
|
59
|
+
return shortNames[i];
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Handle any remaining duplicates with numeric suffixes
|
|
63
|
+
const finalNames = [];
|
|
64
|
+
const used = new Map();
|
|
65
|
+
for (const name of resolved) {
|
|
66
|
+
const count = used.get(name) ?? 0;
|
|
67
|
+
finalNames.push(count === 0 ? name : `${name}${count}`);
|
|
68
|
+
used.set(name, count + 1);
|
|
69
|
+
}
|
|
70
|
+
return finalNames;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Generates TypeScript files from OntologyFullMetadata, replicating
|
|
75
|
+
* the pattern from maker's writeStaticObjects().
|
|
76
|
+
*
|
|
77
|
+
* Each entity gets its own file with wrapWithProxy, plus an index.ts
|
|
78
|
+
* that re-exports everything.
|
|
79
|
+
*/
|
|
80
|
+
export function writeImportedOntology(metadata, outputDir) {
|
|
81
|
+
const codegenDir = path.resolve(outputDir, "codegen");
|
|
82
|
+
|
|
83
|
+
// Clean and create directories
|
|
84
|
+
for (const dirName of Object.values(DIR_NAME_MAP)) {
|
|
85
|
+
const dirPath = path.join(codegenDir, dirName);
|
|
86
|
+
if (fs.existsSync(dirPath)) {
|
|
87
|
+
fs.rmSync(dirPath, {
|
|
88
|
+
recursive: true,
|
|
89
|
+
force: true
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
fs.mkdirSync(dirPath, {
|
|
93
|
+
recursive: true
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Pass 1: Convert all entities
|
|
98
|
+
const entries = [];
|
|
99
|
+
for (const [_apiName, spt] of Object.entries(metadata.sharedPropertyTypes)) {
|
|
100
|
+
const converted = convertSharedPropertyType(spt);
|
|
101
|
+
if (converted) {
|
|
102
|
+
entries.push({
|
|
103
|
+
apiName: converted.apiName,
|
|
104
|
+
entityType: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,
|
|
105
|
+
entity: converted
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const [_apiName, iface] of Object.entries(metadata.interfaceTypes)) {
|
|
110
|
+
const converted = convertInterfaceType(iface, metadata.interfaceTypes);
|
|
111
|
+
entries.push({
|
|
112
|
+
apiName: converted.apiName,
|
|
113
|
+
entityType: OntologyEntityTypeEnum.INTERFACE_TYPE,
|
|
114
|
+
entity: converted
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
for (const [_apiName, objFull] of Object.entries(metadata.objectTypes)) {
|
|
118
|
+
const converted = convertObjectType(objFull);
|
|
119
|
+
entries.push({
|
|
120
|
+
apiName: converted.apiName,
|
|
121
|
+
entityType: OntologyEntityTypeEnum.OBJECT_TYPE,
|
|
122
|
+
entity: converted
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
for (const [_apiName, action] of Object.entries(metadata.actionTypes)) {
|
|
126
|
+
const converted = convertActionType(action);
|
|
127
|
+
entries.push({
|
|
128
|
+
apiName: converted.apiName,
|
|
129
|
+
entityType: OntologyEntityTypeEnum.ACTION_TYPE,
|
|
130
|
+
entity: converted
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Pass 2: Resolve unique variable names across all entities
|
|
135
|
+
const varNames = resolveVarNames(entries.map(e => e.apiName));
|
|
136
|
+
|
|
137
|
+
// Pass 3: Write files with resolved names
|
|
138
|
+
const topLevelExports = [];
|
|
139
|
+
for (let i = 0; i < entries.length; i++) {
|
|
140
|
+
writeEntityFile(codegenDir, entries[i].entityType, entries[i].entity, varNames[i], topLevelExports);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Write index.ts
|
|
144
|
+
if (topLevelExports.length > 0) {
|
|
145
|
+
const indexContent = topLevelExports.join("\n") + "\n";
|
|
146
|
+
const indexPath = path.join(outputDir, "index.ts");
|
|
147
|
+
fs.writeFileSync(indexPath, indexContent, {
|
|
148
|
+
flag: "w"
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function writeEntityFile(codegenDir, entityType, entity, varName, topLevelExports) {
|
|
153
|
+
const typeName = TYPE_NAME_MAP[entityType];
|
|
154
|
+
const dirName = DIR_NAME_MAP[entityType];
|
|
155
|
+
const entityJSON = JSON.stringify(entity, null, 2).replace(/("__type"\s*:\s*)"([^"]*)"/g, (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`);
|
|
156
|
+
const filePath = path.join(codegenDir, dirName, `${varName}.ts`);
|
|
157
|
+
fs.writeFileSync(filePath, `import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';
|
|
158
|
+
import type { ${typeName} } from '@osdk/maker';
|
|
159
|
+
|
|
160
|
+
/** @type {import('@osdk/maker').${typeName}} */
|
|
161
|
+
const ${varName}_base: ${typeName} = ${entityJSON} as unknown as ${typeName};
|
|
162
|
+
|
|
163
|
+
export const ${varName}: ${typeName} = wrapWithProxy(${varName}_base);
|
|
164
|
+
`, {
|
|
165
|
+
flag: "w"
|
|
166
|
+
});
|
|
167
|
+
topLevelExports.push(`export { ${varName} } from "./codegen/${dirName}/${varName}.js";`);
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=writeImportedOntology.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeImportedOntology.js","names":["OntologyEntityTypeEnum","fs","path","convertActionType","convertInterfaceType","convertObjectType","convertSharedPropertyType","camel","fullCamel","withoutNamespace","TYPE_NAME_MAP","OBJECT_TYPE","ACTION_TYPE","INTERFACE_TYPE","SHARED_PROPERTY_TYPE","DIR_NAME_MAP","resolveVarNames","apiNames","shortNames","map","n","counts","Map","name","set","get","resolved","apiName","i","finalNames","used","count","push","writeImportedOntology","metadata","outputDir","codegenDir","resolve","dirName","Object","values","dirPath","join","existsSync","rmSync","recursive","force","mkdirSync","entries","_apiName","spt","sharedPropertyTypes","converted","entityType","entity","iface","interfaceTypes","objFull","objectTypes","action","actionTypes","varNames","e","topLevelExports","length","writeEntityFile","indexContent","indexPath","writeFileSync","flag","varName","typeName","entityJSON","JSON","stringify","replace","_","prefix","value","filePath"],"sources":["writeImportedOntology.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 { OntologyEntityTypeEnum } from \"@osdk/maker\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { convertActionType } from \"./convertActionType.js\";\nimport { convertInterfaceType } from \"./convertInterfaceType.js\";\nimport { convertObjectType } from \"./convertObjectType.js\";\nimport { convertSharedPropertyType } from \"./convertSharedPropertyType.js\";\nimport { camel, fullCamel, withoutNamespace } from \"./utils.js\";\n\ninterface OntologyFullMetadata {\n objectTypes: Record<string, {\n objectType: {\n apiName: string;\n displayName?: string;\n description?: string;\n primaryKey: string;\n titleProperty: string;\n status: string;\n visibility?: string;\n properties: Record<\n string,\n {\n displayName?: string;\n description?: string;\n dataType: { type: string; [key: string]: unknown };\n }\n >;\n };\n sharedPropertyTypeMapping?: Record<string, string>;\n }>;\n actionTypes: Record<string, {\n apiName: string;\n displayName?: string;\n description?: string;\n status: string;\n parameters: Record<string, {\n displayName?: string;\n description?: string;\n dataType: { type: string; [key: string]: unknown };\n required: boolean;\n }>;\n operations: Array<{ type: string; [key: string]: unknown }>;\n }>;\n interfaceTypes: Record<string, {\n apiName: string;\n displayName?: string;\n description?: string;\n extendsInterfaces: ReadonlyArray<string>;\n properties: Record<string, {\n apiName: string;\n displayName?: string;\n description?: string;\n dataType: { type: string; [key: string]: unknown };\n }>;\n links: Record<string, {\n apiName: string;\n displayName?: string;\n description?: string;\n cardinality: string;\n required: boolean;\n linkedEntityApiName: { type: string; apiName?: string };\n }>;\n }>;\n sharedPropertyTypes: Record<string, {\n apiName: string;\n displayName?: string;\n description?: string;\n dataType: { type: string; [key: string]: unknown };\n }>;\n}\n\nconst TYPE_NAME_MAP: Record<string, string> = {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"ObjectType\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"ActionType\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"InterfaceType\",\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"SharedPropertyType\",\n};\n\nconst DIR_NAME_MAP: Record<string, string> = {\n [OntologyEntityTypeEnum.OBJECT_TYPE]: \"object-types\",\n [OntologyEntityTypeEnum.ACTION_TYPE]: \"action-types\",\n [OntologyEntityTypeEnum.INTERFACE_TYPE]: \"interface-types\",\n [OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE]: \"shared-property-types\",\n};\n\ninterface EntityEntry {\n apiName: string;\n entityType: OntologyEntityTypeEnum;\n entity: unknown;\n}\n\n/**\n * Resolves unique variable/file names for a list of apiNames.\n *\n * First tries the short name (namespace stripped, camelCase).\n * If that collides, all colliding entries are escalated to the full\n * camelCase name (namespace included). Any remaining duplicates get\n * a numeric suffix.\n */\nexport function resolveVarNames(apiNames: string[]): string[] {\n const shortNames = apiNames.map(n => camel(withoutNamespace(n)));\n\n // Find which short names appear more than once\n const counts = new Map<string, number>();\n for (const name of shortNames) {\n counts.set(name, (counts.get(name) ?? 0) + 1);\n }\n\n // Escalate conflicting names to fullCamel\n const resolved = apiNames.map((apiName, i) => {\n if (counts.get(shortNames[i])! > 1) {\n return fullCamel(apiName);\n }\n return shortNames[i];\n });\n\n // Handle any remaining duplicates with numeric suffixes\n const finalNames: string[] = [];\n const used = new Map<string, number>();\n for (const name of resolved) {\n const count = used.get(name) ?? 0;\n finalNames.push(count === 0 ? name : `${name}${count}`);\n used.set(name, count + 1);\n }\n\n return finalNames;\n}\n\n/**\n * Generates TypeScript files from OntologyFullMetadata, replicating\n * the pattern from maker's writeStaticObjects().\n *\n * Each entity gets its own file with wrapWithProxy, plus an index.ts\n * that re-exports everything.\n */\nexport function writeImportedOntology(\n metadata: OntologyFullMetadata,\n outputDir: string,\n): void {\n const codegenDir = path.resolve(outputDir, \"codegen\");\n\n // Clean and create directories\n for (const dirName of Object.values(DIR_NAME_MAP)) {\n const dirPath = path.join(codegenDir, dirName);\n if (fs.existsSync(dirPath)) {\n fs.rmSync(dirPath, { recursive: true, force: true });\n }\n fs.mkdirSync(dirPath, { recursive: true });\n }\n\n // Pass 1: Convert all entities\n const entries: EntityEntry[] = [];\n\n for (const [_apiName, spt] of Object.entries(metadata.sharedPropertyTypes)) {\n const converted = convertSharedPropertyType(spt);\n if (converted) {\n entries.push({\n apiName: converted.apiName,\n entityType: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,\n entity: converted,\n });\n }\n }\n\n for (const [_apiName, iface] of Object.entries(metadata.interfaceTypes)) {\n const converted = convertInterfaceType(iface, metadata.interfaceTypes);\n entries.push({\n apiName: converted.apiName,\n entityType: OntologyEntityTypeEnum.INTERFACE_TYPE,\n entity: converted,\n });\n }\n\n for (const [_apiName, objFull] of Object.entries(metadata.objectTypes)) {\n const converted = convertObjectType(objFull);\n entries.push({\n apiName: converted.apiName,\n entityType: OntologyEntityTypeEnum.OBJECT_TYPE,\n entity: converted,\n });\n }\n\n for (const [_apiName, action] of Object.entries(metadata.actionTypes)) {\n const converted = convertActionType(action);\n entries.push({\n apiName: converted.apiName,\n entityType: OntologyEntityTypeEnum.ACTION_TYPE,\n entity: converted,\n });\n }\n\n // Pass 2: Resolve unique variable names across all entities\n const varNames = resolveVarNames(entries.map(e => e.apiName));\n\n // Pass 3: Write files with resolved names\n const topLevelExports: string[] = [];\n for (let i = 0; i < entries.length; i++) {\n writeEntityFile(\n codegenDir,\n entries[i].entityType,\n entries[i].entity,\n varNames[i],\n topLevelExports,\n );\n }\n\n // Write index.ts\n if (topLevelExports.length > 0) {\n const indexContent = topLevelExports.join(\"\\n\") + \"\\n\";\n const indexPath = path.join(outputDir, \"index.ts\");\n fs.writeFileSync(indexPath, indexContent, { flag: \"w\" });\n }\n}\n\nfunction writeEntityFile(\n codegenDir: string,\n entityType: OntologyEntityTypeEnum,\n entity: unknown,\n varName: string,\n topLevelExports: string[],\n): void {\n const typeName = TYPE_NAME_MAP[entityType];\n const dirName = DIR_NAME_MAP[entityType];\n\n const entityJSON = JSON.stringify(entity, null, 2).replace(\n /(\"__type\"\\s*:\\s*)\"([^\"]*)\"/g,\n (_, prefix, value) => `${prefix}OntologyEntityTypeEnum.${value}`,\n );\n\n const content =\n `import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\nimport type { ${typeName} } from '@osdk/maker';\n\n/** @type {import('@osdk/maker').${typeName}} */\nconst ${varName}_base: ${typeName} = ${entityJSON} as unknown as ${typeName};\n\nexport const ${varName}: ${typeName} = wrapWithProxy(${varName}_base);\n`;\n\n const filePath = path.join(codegenDir, dirName, `${varName}.ts`);\n fs.writeFileSync(filePath, content, { flag: \"w\" });\n\n topLevelExports.push(\n `export { ${varName} } from \"./codegen/${dirName}/${varName}.js\";`,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,sBAAsB,QAAQ,aAAa;AACpD,OAAO,KAAKC,EAAE,MAAM,SAAS;AAC7B,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,yBAAyB,QAAQ,gCAAgC;AAC1E,SAASC,KAAK,EAAEC,SA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CAACmE,aAAa,CAACW,QAAQ,EAVvB;AACJ,gBAAgBR,QAAQ;AACxB;AACA,mCAAmCA,QAAQ;AAC3C,QAAQD,OAAO,UAAUC,QAAQ,MAAMC,UAAU,kBAAkBD,QAAQ;AAC3E;AACA,eAAeD,OAAO,KAAKC,QAAQ,oBAAoBD,OAAO;AAC9D,CAAC,EAGqC;IAAED,IAAI,EAAE;EAAI,CAAC,CAAC;EAElDN,eAAe,CAAC/B,IAAI,CAClB,YAAYsC,OAAO,sBAAsBhC,OAAO,IAAIgC,OAAO,OAC7D,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export { default } from "./cli/main.js";
|
|
18
|
+
export { writeImportedOntology } from "./generate/writeImportedOntology.js";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","writeImportedOntology"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { default as default } from \"./cli/main.js\";\nexport { writeImportedOntology } from \"./generate/writeImportedOntology.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAkB,QAAQ,eAAe;AAClD,SAASC,qBAAqB,QAAQ,qCAAqC","ignoreList":[]}
|