@osdk/generator 1.0.1 → 1.0.2
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 +7 -0
- package/build/js/index.cjs +1412 -184
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +1411 -183
- package/build/js/index.mjs.map +1 -1
- package/build/types/MinimalFs.d.ts +2 -0
- package/build/types/util/test/createMockMinimalFiles.d.ts +2 -1
- package/build/types/util/verifyOutdir.d.ts +8 -0
- package/package.json +1 -1
package/build/js/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var path15 = require('path');
|
|
4
4
|
var prettier = require('prettier');
|
|
5
|
-
var
|
|
5
|
+
var organizeImports = require('prettier-plugin-organize-imports');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
@@ -24,69 +24,279 @@ function _interopNamespace(e) {
|
|
|
24
24
|
return Object.freeze(n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
var
|
|
28
|
-
var
|
|
27
|
+
var path15__namespace = /*#__PURE__*/_interopNamespace(path15);
|
|
28
|
+
var organizeImports__default = /*#__PURE__*/_interopDefault(organizeImports);
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
// src/v1.1/generateClientSdkVersionOneDotOne.ts
|
|
31
|
+
|
|
32
|
+
// src/shared/sanitizeMetadata.ts
|
|
33
|
+
function sanitizeMetadata(ontology) {
|
|
34
|
+
return {
|
|
35
|
+
...ontology,
|
|
36
|
+
actionTypes: Object.fromEntries(Object.values(ontology.actionTypes).map((actionType) => {
|
|
37
|
+
return [camelize(actionType.apiName), {
|
|
38
|
+
...actionType,
|
|
39
|
+
apiName: camelize(actionType.apiName)
|
|
40
|
+
}];
|
|
41
|
+
}))
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function camelize(name) {
|
|
45
|
+
return name.replace(/-./g, (segment) => segment[1].toUpperCase());
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/util/verifyOutdir.ts
|
|
49
|
+
async function verifyOutdir(outDir, fs) {
|
|
50
|
+
try {
|
|
51
|
+
const contents = await fs.readdir(outDir);
|
|
52
|
+
if (contents.length !== 0) {
|
|
53
|
+
throw new Error(`outDir ${outDir} is not empty, please delete its contents and try again`);
|
|
54
|
+
}
|
|
55
|
+
} catch (e) {
|
|
56
|
+
if (e.code === "ENOENT") ; else {
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/shared/getEditedEntities.ts
|
|
63
|
+
function getModifiedEntityTypes(action) {
|
|
64
|
+
const addedObjects = /* @__PURE__ */ new Set();
|
|
65
|
+
const modifiedObjects = /* @__PURE__ */ new Set();
|
|
66
|
+
for (const operation of action.operations) {
|
|
67
|
+
switch (operation.type) {
|
|
68
|
+
case "createObject":
|
|
69
|
+
addedObjects.add(operation.objectTypeApiName);
|
|
70
|
+
break;
|
|
71
|
+
case "modifyObject":
|
|
72
|
+
modifiedObjects.add(operation.objectTypeApiName);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
addedObjects,
|
|
78
|
+
modifiedObjects
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function formatTs(contents) {
|
|
82
|
+
return prettier.format(contents, {
|
|
83
|
+
parser: "typescript",
|
|
84
|
+
singleQuote: true,
|
|
85
|
+
trailingComma: "all",
|
|
86
|
+
plugins: [organizeImports__default.default],
|
|
87
|
+
tabWidth: 2,
|
|
88
|
+
printWidth: 120
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/v1.1/generateActions.ts
|
|
93
|
+
async function generateActions(ontology, fs, outDir, importExt = "") {
|
|
94
|
+
const importedObjects = /* @__PURE__ */ new Set();
|
|
95
|
+
let actionSignatures = [];
|
|
96
|
+
for (const action of Object.values(ontology.actionTypes)) {
|
|
97
|
+
const entries = Object.entries(action.parameters);
|
|
98
|
+
const modifiedEntityTypes = getModifiedEntityTypes(action);
|
|
99
|
+
const addedObjects = Array.from(modifiedEntityTypes.addedObjects);
|
|
100
|
+
const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);
|
|
101
|
+
addedObjects.forEach(importedObjects.add, importedObjects);
|
|
102
|
+
modifiedObjects.forEach(importedObjects.add, importedObjects);
|
|
103
|
+
let jsDocBlock = ["/**"];
|
|
104
|
+
if (action.description) {
|
|
105
|
+
jsDocBlock.push(`* ${action.description}`);
|
|
106
|
+
}
|
|
107
|
+
let parameterBlock = "";
|
|
108
|
+
if (entries.length > 0) {
|
|
109
|
+
parameterBlock = `params: {
|
|
110
|
+
`;
|
|
111
|
+
for (const [parameterName, parameterData] of entries) {
|
|
112
|
+
parameterBlock += `"${parameterName}"`;
|
|
113
|
+
parameterBlock += parameterData.required ? ": " : "?: ";
|
|
114
|
+
const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);
|
|
115
|
+
parameterBlock += `${typeScriptType};
|
|
116
|
+
`;
|
|
117
|
+
jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);
|
|
118
|
+
}
|
|
119
|
+
parameterBlock += "}, ";
|
|
120
|
+
}
|
|
121
|
+
jsDocBlock.push(`*/`);
|
|
122
|
+
actionSignatures.push(`
|
|
123
|
+
${jsDocBlock.join("\n")}
|
|
124
|
+
${action.apiName}<O extends ActionExecutionOptions>(${parameterBlock}options?: O):
|
|
125
|
+
Promise<Result<ActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(" | ") : "void"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(" | ") : "void"}>>, ActionError>>;`);
|
|
126
|
+
}
|
|
127
|
+
await fs.mkdir(outDir, {
|
|
128
|
+
recursive: true
|
|
129
|
+
});
|
|
130
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "Actions.ts"), await formatTs(`
|
|
37
131
|
import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, ActionError, Result, ActionResponseFromOptions } from "@osdk/legacy-client";
|
|
38
|
-
${Array.from(
|
|
39
|
-
`)}
|
|
132
|
+
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
40
133
|
export interface Actions {
|
|
41
|
-
${
|
|
42
|
-
`)}
|
|
134
|
+
${actionSignatures.join("\n")}
|
|
43
135
|
}
|
|
44
|
-
`));
|
|
45
|
-
|
|
136
|
+
`));
|
|
137
|
+
}
|
|
138
|
+
function getTypeScriptTypeFromDataType(actionParameter, importedObjects) {
|
|
139
|
+
switch (actionParameter.type) {
|
|
140
|
+
case "objectSet": {
|
|
141
|
+
const objectType = actionParameter.objectTypeApiName;
|
|
142
|
+
importedObjects.add(objectType);
|
|
143
|
+
return `ObjectSet<${objectType}>`;
|
|
144
|
+
}
|
|
145
|
+
case "object": {
|
|
146
|
+
const objectType = actionParameter.objectTypeApiName;
|
|
147
|
+
importedObjects.add(objectType);
|
|
148
|
+
return `${objectType} | ${objectType}["__primaryKey"]`;
|
|
149
|
+
}
|
|
150
|
+
case "array":
|
|
151
|
+
return `Array<${getTypeScriptTypeFromDataType(actionParameter.subType, importedObjects)}>`;
|
|
152
|
+
case "string":
|
|
153
|
+
return `string`;
|
|
154
|
+
case "boolean":
|
|
155
|
+
return `boolean`;
|
|
156
|
+
case "attachment":
|
|
157
|
+
return `Attachment`;
|
|
158
|
+
case "date":
|
|
159
|
+
return `LocalDate`;
|
|
160
|
+
case "double":
|
|
161
|
+
case "integer":
|
|
162
|
+
case "long":
|
|
163
|
+
return `number`;
|
|
164
|
+
case "timestamp":
|
|
165
|
+
return `Timestamp`;
|
|
166
|
+
default:
|
|
167
|
+
throw new Error(`Unsupported action parameter type: ${actionParameter}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// src/v1.1/backcompat/util/reexportConsts.ts
|
|
172
|
+
function reexportConsts(typesToExport) {
|
|
173
|
+
return `
|
|
174
|
+
import { ${typesToExport.map((q) => `${q} as OG_${q}`).join(", ")}} from "@osdk/legacy-client";
|
|
46
175
|
|
|
47
|
-
${
|
|
176
|
+
${typesToExport.map((q) => `
|
|
48
177
|
/** @deprecated submodule imports arent public api **/
|
|
49
|
-
export const ${
|
|
50
|
-
`).join(
|
|
178
|
+
export const ${q} = OG_${q};
|
|
179
|
+
`).join("\n\n")}
|
|
180
|
+
`;
|
|
181
|
+
}
|
|
51
182
|
|
|
52
|
-
|
|
53
|
-
|
|
183
|
+
// src/v1.1/backcompat/internal-foundry-oauth-dist/generateConfidentialClientDir.ts
|
|
184
|
+
async function generateConfidentialClientDir(fs, oauthDistDir) {
|
|
185
|
+
const confidentialClientDistDir = path15__namespace.default.join(oauthDistDir, "ConfidentialClient");
|
|
186
|
+
await fs.mkdir(confidentialClientDistDir, {
|
|
187
|
+
recursive: true
|
|
188
|
+
});
|
|
189
|
+
await fs.writeFile(path15__namespace.default.join(confidentialClientDistDir, "index.ts"), await formatTs(`
|
|
54
190
|
export * from "./ConfidentialClientAuth";
|
|
55
|
-
`))
|
|
56
|
-
|
|
57
|
-
|
|
191
|
+
`));
|
|
192
|
+
await fs.writeFile(path15__namespace.default.join(confidentialClientDistDir, "ConfidentialClientAuth.ts"), await formatTs(`
|
|
193
|
+
${reexportConsts(["ConfidentialClientAuth"])}
|
|
194
|
+
`));
|
|
195
|
+
}
|
|
196
|
+
async function generatePublicClientDir(fs, oauthDistDir) {
|
|
197
|
+
const publicClientDistDir = path15__namespace.default.join(oauthDistDir, "PublicClient");
|
|
198
|
+
await fs.mkdir(publicClientDistDir, {
|
|
199
|
+
recursive: true
|
|
200
|
+
});
|
|
201
|
+
await fs.writeFile(path15__namespace.default.join(publicClientDistDir, "index.ts"), await formatTs(`
|
|
58
202
|
export * from "./PublicClientAuth";
|
|
59
|
-
`))
|
|
60
|
-
|
|
61
|
-
|
|
203
|
+
`));
|
|
204
|
+
await fs.writeFile(path15__namespace.default.join(publicClientDistDir, "PublicClientAuth.ts"), await formatTs(`
|
|
205
|
+
${reexportConsts(["PublicClientAuth"])}
|
|
206
|
+
`));
|
|
207
|
+
}
|
|
208
|
+
async function generateUserTokenDir(fs, oauthDistDir) {
|
|
209
|
+
const userTokenDistDir = path15__namespace.default.join(oauthDistDir, "UserToken");
|
|
210
|
+
await fs.mkdir(userTokenDistDir, {
|
|
211
|
+
recursive: true
|
|
212
|
+
});
|
|
213
|
+
await fs.writeFile(path15__namespace.default.join(userTokenDistDir, "index.ts"), await formatTs(`
|
|
62
214
|
export * from "./UserTokenAuth";
|
|
63
|
-
`))
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
215
|
+
`));
|
|
216
|
+
await fs.writeFile(path15__namespace.default.join(userTokenDistDir, "UserTokenAuth.ts"), await formatTs(`
|
|
217
|
+
${reexportConsts(["UserTokenAuth"])}
|
|
218
|
+
`));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// src/v1.1/backcompat/util/reexportTypes.ts
|
|
222
|
+
function reexportTypes(typesToExport, genericArgsLeft = "", genericArgsRight = cleanup(genericArgsLeft)) {
|
|
223
|
+
return `
|
|
224
|
+
import type { ${typesToExport.map((q) => `${q} as OG_${q}`).join(", ")}} from "@osdk/legacy-client";
|
|
67
225
|
|
|
68
|
-
${
|
|
226
|
+
${typesToExport.map((q) => `
|
|
69
227
|
/** @deprecated submodule imports arent public api **/
|
|
70
|
-
export type ${
|
|
71
|
-
`).join(
|
|
228
|
+
export type ${q}${genericArgsLeft} = OG_${q}${genericArgsRight};
|
|
229
|
+
`).join("\n\n")}
|
|
230
|
+
`;
|
|
231
|
+
}
|
|
232
|
+
var captureInBracketsRegex = /<(.*?)>/;
|
|
233
|
+
var captureGenericParamNameRegex = /^\s?(.+?)( extends .*?)?( = .*?)?\s?$/;
|
|
234
|
+
function cleanup(s) {
|
|
235
|
+
if (s.length === 0)
|
|
236
|
+
return "";
|
|
237
|
+
const genericParameterNames = captureInBracketsRegex.exec(s)?.[1]?.split(",")?.map((a) => {
|
|
238
|
+
return captureGenericParamNameRegex.exec(a)?.[1] ?? a;
|
|
239
|
+
});
|
|
240
|
+
return `<${genericParameterNames?.join(",")}>`;
|
|
241
|
+
}
|
|
72
242
|
|
|
73
|
-
|
|
74
|
-
|
|
243
|
+
// src/v1.1/backcompat/generateOAuthDistDir.ts
|
|
244
|
+
async function generateOAuthClientDistDir(outDir, fs) {
|
|
245
|
+
const oauthDistDir = path15__namespace.join(outDir, "internal", "@foundry", "oauth-client", "dist");
|
|
246
|
+
await fs.mkdir(oauthDistDir, {
|
|
247
|
+
recursive: true
|
|
248
|
+
});
|
|
249
|
+
await fs.writeFile(path15__namespace.join(oauthDistDir, "index.ts"), await formatTs(`
|
|
75
250
|
export * from "./Auth";
|
|
76
251
|
export * from "./ConfidentialClient";
|
|
77
252
|
export * from "./OAuthClient";
|
|
78
253
|
export * from "./PublicClient";
|
|
79
254
|
export * from "./Token";
|
|
80
255
|
export * from "./UserToken";
|
|
81
|
-
`))
|
|
256
|
+
`));
|
|
257
|
+
await fs.writeFile(path15__namespace.join(oauthDistDir, "Auth.ts"), await formatTs(reexportTypes(["Auth"])));
|
|
258
|
+
await fs.writeFile(path15__namespace.join(oauthDistDir, "Token.ts"), await formatTs(reexportTypes(["Token", "TokenValue"])));
|
|
259
|
+
await fs.writeFile(path15__namespace.join(oauthDistDir, "OAuthClient.ts"), await formatTs(reexportTypes(["AuthSubscription", "UnsubscribeFunction", "SignInResponse", "RefreshResponse", "SignOutResponse"])));
|
|
260
|
+
await fs.writeFile(path15__namespace.join(oauthDistDir, "OAuthToken.ts"), await formatTs(reexportConsts(["OAuthToken"])));
|
|
261
|
+
await fs.writeFile(path15__namespace.join(oauthDistDir, "Auth.ts"), await formatTs(reexportTypes(["Auth"])));
|
|
262
|
+
await generateConfidentialClientDir(fs, oauthDistDir);
|
|
263
|
+
await generatePublicClientDir(fs, oauthDistDir);
|
|
264
|
+
await generateUserTokenDir(fs, oauthDistDir);
|
|
265
|
+
}
|
|
266
|
+
async function generateAggregationsAggregations(fs, aggregationsDir) {
|
|
267
|
+
await fs.writeFile(path15__namespace.join(aggregationsDir, "Aggregations.ts"), await formatTs(`
|
|
82
268
|
import { LocalDate, Timestamp } from "@osdk/legacy-client";
|
|
83
|
-
|
|
84
|
-
|
|
269
|
+
` + reexportTypes(["Double", "Rangeable", "MetricValue", "Date", "BucketKey", "BucketValue", "TimeUnit", "BucketGroup", "Metrics", "AggregatableProperties", "AggregationClause"]) + reexportTypes(["Range"], "<T extends Rangeable>", "<T>") + reexportTypes(["BaseGroupBy"], "<_T extends BucketValue = BucketValue>") + reexportTypes(["Duration"], "<_T extends Timestamp | LocalDate = Timestamp | LocalDate>") + reexportTypes(["AggregatableProperty", "MultipleAggregationsOperations"], "<_T extends MetricValue = MetricValue>") + reexportTypes(["AggregationGroup"], "<TMetrics extends Metrics | MetricValue, TBucketGroup extends BucketGroup>") + reexportTypes(["Bucketing"], "<_T extends string , _X extends BucketValue>") + reexportTypes(["AggregationResult"], "<TBucketGroup extends BucketGroup, TMetrics extends Metrics | MetricValue>") + reexportTypes(["BaseBucketing"], "<TBucketKey extends BucketKey, TBucketValue extends BucketValue, Kind extends string>") + reexportTypes(["ExactValueBucketing", "InternalBucketing"], `<TBucketKey extends BucketKey, TBucketValue extends BucketValue>`) + reexportTypes(["RangeBucketing", "FixedWidthBucketing"], `<TBucketKey extends BucketKey, TBucketValue extends Range<Rangeable>>`) + reexportTypes(["DurationBucketing"], `<TBucketKey extends BucketKey, TBucketValue extends Date>`) + reexportTypes(["InternalBucketingVisitor"], "<TBucketKey extends BucketKey, T extends BucketValue, R>") + reexportTypes(["AggregationBuilderResult"], "<T, TMultipleAggregationProperties>") + reexportTypes(["AggregatablePropertiesForResult", "AggregatablePropertyNamesForResult"], "<TAggregatableProperties, TResult extends MetricValue>") + reexportConsts(["assertBucketingInternal", "visitInternalBucketing"]) + reexportTypes(["AggregatableObjectSetStep"], "<TAggregatableProperties, TMultipleAggregationProperties, TBucketableProperties, TBucketGroup extends BucketGroup = {}>") + reexportTypes(["GroupedTerminalAggregationOperations"], "<TAggregatableProperties, TMultipleAggregationProperties, TBucketGroup extends BucketGroup = {}>")));
|
|
270
|
+
}
|
|
271
|
+
async function generateGroupBy(fs, aggregationsDir) {
|
|
272
|
+
await fs.mkdir(path15__namespace.join(aggregationsDir, "groupBy"), {
|
|
273
|
+
recursive: true
|
|
274
|
+
});
|
|
275
|
+
const groupBys = ["BooleanGroupBy", "LocalDateGroupBy", "NumericGroupBy", "StringGroupBy", "TimestampGroupBy"];
|
|
276
|
+
const reexportFiles = [...groupBys, "GroupKeyType"];
|
|
277
|
+
for (const key of reexportFiles) {
|
|
278
|
+
await fs.writeFile(path15__namespace.join(aggregationsDir, "groupBy", `${key}.ts`), await formatTs(`export {${key}} from "./index";`));
|
|
279
|
+
}
|
|
280
|
+
await fs.writeFile(path15__namespace.join(aggregationsDir, "groupBy", "index.ts"), await formatTs(`import { Bucketing, BucketKey, Duration, Range, Rangeable } from "../Aggregations";` + reexportConsts(groupBys) + reexportTypes(groupBys, "<T extends BucketKey>") + `export {GroupKeyType} from "@osdk/legacy-client";
|
|
281
|
+
`));
|
|
282
|
+
}
|
|
283
|
+
async function generateMetrics(fs, aggregationsDir) {
|
|
284
|
+
const metricsDir = path15__namespace.join(aggregationsDir, "metrics");
|
|
285
|
+
await fs.mkdir(metricsDir, {
|
|
286
|
+
recursive: true
|
|
287
|
+
});
|
|
288
|
+
await fs.writeFile(path15__namespace.join(metricsDir, "metrics.ts"), await formatTs(`export {MetricValueType} from "@osdk/legacy-client";`));
|
|
289
|
+
await fs.writeFile(path15__namespace.join(metricsDir, "ApproximateDistinctCountAggregatableProperty.ts"), await formatTs(reexportConsts(["ApproximateDistinctCountAggregatableProperty"]) + reexportTypes(["ApproximateDistinctCountAggregatableProperty"])));
|
|
290
|
+
await fs.writeFile(path15__namespace.join(metricsDir, "MultipleAggregatableProperty.ts"), await formatTs(`
|
|
85
291
|
import { Double, MetricValue, MultipleAggregationsOperations } from "../Aggregations";
|
|
86
292
|
import { MetricValueType } from "./metrics";
|
|
87
|
-
|
|
293
|
+
` + reexportConsts(["MultipleAggregatableProperty"]) + reexportTypes(["MultipleAggregatableProperty"], "<TResult extends MetricValue = Double>")));
|
|
294
|
+
for (const typeName of ["DefaultAggregatableProperty", "LocalDatePropertyMetric", "NumericPropertyMetric", "TimestampPropertyMetric"]) {
|
|
295
|
+
await fs.writeFile(path15__namespace.join(metricsDir, `${typeName}.ts`), await formatTs(`
|
|
88
296
|
import { MultipleAggregatableProperty } from "./MultipleAggregatableProperty";
|
|
89
|
-
|
|
297
|
+
` + reexportConsts([typeName])));
|
|
298
|
+
}
|
|
299
|
+
await fs.writeFile(path15__namespace.join(metricsDir, "index.ts"), await formatTs(`
|
|
90
300
|
export * from "./ApproximateDistinctCountAggregatableProperty";
|
|
91
301
|
export * from "./DefaultAggregatableProperty";
|
|
92
302
|
export * from "./LocalDatePropertyMetric";
|
|
@@ -94,9 +304,21 @@ function B(e){return {...e,actionTypes:Object.fromEntries(Object.values(e.action
|
|
|
94
304
|
export * from "./MultipleAggregatableProperty";
|
|
95
305
|
export * from "./NumericPropertyMetric";
|
|
96
306
|
export * from "./TimestampPropertyMetric";
|
|
97
|
-
`));
|
|
98
|
-
|
|
99
|
-
|
|
307
|
+
`));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateAggregationsDir.ts
|
|
311
|
+
async function generateAggregationsDir(fs, runtimeDistDir) {
|
|
312
|
+
const aggregationsDir = path15__namespace.join(runtimeDistDir, "aggregations");
|
|
313
|
+
await fs.mkdir(aggregationsDir, {
|
|
314
|
+
recursive: true
|
|
315
|
+
});
|
|
316
|
+
await generateGroupBy(fs, aggregationsDir);
|
|
317
|
+
await generateAggregationsAggregations(fs, aggregationsDir);
|
|
318
|
+
await generateMetrics(fs, aggregationsDir);
|
|
319
|
+
await fs.writeFile(path15__namespace.join(aggregationsDir, "index.ts"), await formatTs(`
|
|
320
|
+
${""}
|
|
321
|
+
${""}
|
|
100
322
|
|
|
101
323
|
export * from "./Aggregations";
|
|
102
324
|
export * from "./ComputeStep";
|
|
@@ -104,16 +326,33 @@ function B(e){return {...e,actionTypes:Object.fromEntries(Object.values(e.action
|
|
|
104
326
|
export * from "./groupBy";
|
|
105
327
|
export * from "./internalAggregationRequest";
|
|
106
328
|
export * from "./metrics";
|
|
107
|
-
`))
|
|
329
|
+
`));
|
|
330
|
+
await fs.writeFile(path15__namespace.join(aggregationsDir, "ComputeStep.ts"), await formatTs(`
|
|
108
331
|
import { ObjectSetDefinition } from "../baseTypes";
|
|
109
332
|
import { FoundryClientOptions } from "../client";
|
|
110
333
|
import { AggregateObjectsError, OntologyMetadata, Result } from "../ontologyProvider";
|
|
111
334
|
import { AggregationClause, AggregationResult, BucketGroup, BucketValue, InternalBucketing, Metrics, MetricValue } from "./Aggregations";
|
|
112
|
-
|
|
335
|
+
` + reexportConsts(["ComputeStep"]) + reexportTypes(["ComputeStep"], "<TBucketGroup extends BucketGroup, TMetrics extends Metrics | MetricValue> ") + reexportTypes(["AggregationComputeStep"], "<TBucketGroup extends BucketGroup, TMetrics extends Metrics | MetricValue>") + `
|
|
113
336
|
|
|
114
|
-
`))
|
|
337
|
+
`));
|
|
338
|
+
await fs.writeFile(path15__namespace.join(aggregationsDir, "CountOperation.ts"), await formatTs(`` + reexportConsts(["CountOperation", "isCountOperation"]) + reexportTypes(["CountOperation"])));
|
|
339
|
+
await fs.writeFile(path15__namespace.join(aggregationsDir, "internalAggregationRequest.ts"), await formatTs(reexportTypes(["InternalAggregationRequest"])));
|
|
340
|
+
}
|
|
341
|
+
async function generateAttachmentsDir(attachmentsDir, fs) {
|
|
342
|
+
await fs.mkdir(attachmentsDir, {
|
|
343
|
+
recursive: true
|
|
344
|
+
});
|
|
345
|
+
await fs.writeFile(path15__namespace.default.join(attachmentsDir, "index.ts"), await formatTs(`export * from "./Attachment";
|
|
115
346
|
export * from "./Attachments";
|
|
116
|
-
`))
|
|
347
|
+
`));
|
|
348
|
+
await fs.writeFile(path15__namespace.default.join(attachmentsDir, "Attachment.ts"), await formatTs(reexportTypes(["Attachment", "AttachmentMetadata"])));
|
|
349
|
+
await fs.writeFile(path15__namespace.default.join(attachmentsDir, "Attachments.ts"), await formatTs(reexportTypes(["Attachments"])));
|
|
350
|
+
}
|
|
351
|
+
async function generateGeoshapesDir(runtimeDistDir, fs) {
|
|
352
|
+
await fs.mkdir(runtimeDistDir, {
|
|
353
|
+
recursive: true
|
|
354
|
+
});
|
|
355
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "index.ts"), await formatTs(`export * from "./Distance";
|
|
117
356
|
export * from "./GeoJson";
|
|
118
357
|
export * from "./GeometryCollection";
|
|
119
358
|
export * from "./GeoPoint";
|
|
@@ -122,19 +361,64 @@ function B(e){return {...e,actionTypes:Object.fromEntries(Object.values(e.action
|
|
|
122
361
|
export * from "./MultiGeoPoint";
|
|
123
362
|
export * from "./MultiLineString";
|
|
124
363
|
export * from "./MultiPolygon";
|
|
125
|
-
export * from "./Polygon";`))
|
|
364
|
+
export * from "./Polygon";`));
|
|
365
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "Distance.ts"), await formatTs(`` + reexportConsts(["Distance", "DistanceUnit"]) + reexportTypes(["Distance", "DistanceUnit"])));
|
|
366
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "GeoJson.ts"), await formatTs(reexportTypes(["GeoJsonPoint", "GeoJsonPolygon", "GeoJsonLineString", "GeoJsonMultiPoint", "GeoJsonMultiPolygon", "GeoJsonMultiLineString", "GeoJsonGeometryCollection", "GeoJsonGeometry", "GeoJson"])));
|
|
367
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "GeometryCollection.ts"), await formatTs(reexportConsts(["GeometryCollection"])));
|
|
368
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "GeoPoint.ts"), await formatTs(`` + reexportConsts(["isGeoPoint", "GeoPoint", "mapCoordinatesToGeoPoint"]) + reexportTypes(["GeoHash", "Coordinates", "GeoPoint"])));
|
|
369
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "GeoShape.ts"), await formatTs(reexportConsts(["GeoShape"]) + reexportTypes(["GeoShape"])));
|
|
370
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "LineString.ts"), await formatTs(reexportConsts(["LineString"]) + reexportTypes(["LineString"])));
|
|
371
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "MultiGeoPoint.ts"), await formatTs(reexportConsts(["MultiGeoPoint"]) + reexportTypes(["MultiGeoPoint"])));
|
|
372
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "MultiLineString.ts"), await formatTs(reexportConsts(["MultiLineString"]) + reexportTypes(["MultiLineString"])));
|
|
373
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "MultiPolygon.ts"), await formatTs(reexportConsts(["MultiPolygon"]) + reexportTypes(["MultiPolygon"])));
|
|
374
|
+
await fs.writeFile(path15__namespace.join(runtimeDistDir, "Polygon.ts"), await formatTs(reexportConsts(["Polygon"]) + reexportTypes(["LinearRing", "Polygon"])));
|
|
375
|
+
}
|
|
376
|
+
async function generateObjectSetDir(objectSetDir, fs) {
|
|
377
|
+
await fs.mkdir(objectSetDir, {
|
|
378
|
+
recursive: true
|
|
379
|
+
});
|
|
380
|
+
await fs.writeFile(path15__namespace.default.join(objectSetDir, "index.ts"), await formatTs(`
|
|
126
381
|
export * from "./ObjectSetDefinition";
|
|
127
382
|
export * from "./OntologyObjectSet";
|
|
128
|
-
`))
|
|
383
|
+
`));
|
|
384
|
+
await fs.writeFile(path15__namespace.default.join(objectSetDir, "ObjectSetDefinition.ts"), await formatTs(reexportTypes(["BaseObjectSetDefinition", "ReferenceObjectSetDefinition", "StaticObjectSetDefinition", "IntersectObjectSetDefinition", "SubtractObjectSetDefinition", "SearchAroundObjectSetDefinition", "FilterObjectSetDefinition", "ObjectSetDefinition"])));
|
|
385
|
+
await fs.writeFile(path15__namespace.default.join(objectSetDir, "OntologyObjectSet.ts"), await formatTs(reexportTypes(["OntologyObjectSet"])));
|
|
386
|
+
}
|
|
387
|
+
async function generateSharedObjectCodeDir(sharedObjectCodeDir, fs) {
|
|
388
|
+
await fs.mkdir(sharedObjectCodeDir, {
|
|
389
|
+
recursive: true
|
|
390
|
+
});
|
|
391
|
+
await fs.writeFile(path15__namespace.default.join(sharedObjectCodeDir, "index.ts"), await formatTs(`
|
|
129
392
|
export * from "./FilteredPropertiesTerminalOperations";
|
|
130
|
-
`))
|
|
393
|
+
`));
|
|
394
|
+
await fs.writeFile(path15__namespace.default.join(sharedObjectCodeDir, "FilteredPropertiesTerminalOperations.ts"), await formatTs(`import { OntologyObject } from "../OntologyObject` + reexportTypes(["FilteredPropertiesTerminalOperations", "FilteredPropertiesTerminalOperationsWithGet"], "<T extends OntologyObject, V extends Array<keyof T>>")));
|
|
395
|
+
}
|
|
396
|
+
async function generateTimeSeriesDir(timeseriesDir, fs) {
|
|
397
|
+
await fs.mkdir(timeseriesDir, {
|
|
398
|
+
recursive: true
|
|
399
|
+
});
|
|
400
|
+
await fs.writeFile(path15__namespace.join(timeseriesDir, "index.ts"), await formatTs(`
|
|
131
401
|
export * from "./TimeSeries";
|
|
132
402
|
export * from "./TimeSeriesDuration";
|
|
133
403
|
export * from "./TimeSeriesPoint";
|
|
134
|
-
|
|
404
|
+
${""}
|
|
135
405
|
export * from "./TimeSeriesQuery";
|
|
136
406
|
export * from "./TimeSeriesTerminalOperations";
|
|
137
|
-
`))
|
|
407
|
+
`));
|
|
408
|
+
await fs.writeFile(path15__namespace.join(timeseriesDir, "TimeSeries.ts"), await formatTs(reexportTypes(["TimeSeries"], `<T extends number | string>`)));
|
|
409
|
+
await fs.writeFile(path15__namespace.join(timeseriesDir, "TimeSeriesDuration.ts"), await formatTs(reexportTypes([`WhenUnit`, `DurationUnit`, `TimeSeriesDuration`])));
|
|
410
|
+
await fs.writeFile(path15__namespace.join(timeseriesDir, "TimeSeriesPoint.ts"), await formatTs(reexportTypes(["TimeSeriesPoint"], `<T extends number | string>`)));
|
|
411
|
+
await fs.writeFile(path15__namespace.join(timeseriesDir, "TimeSeriesQuery.ts"), await formatTs(reexportTypes(["TimeSeriesQuery"], `<T extends number | string>`)));
|
|
412
|
+
await fs.writeFile(path15__namespace.join(timeseriesDir, "TimeSeriesTerminalOperations.ts"), await formatTs(reexportTypes(["TimeSeriesTerminalOperations", "TimeSeriesIterator"], `<T extends number | string>`)));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// src/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateBaseTypesDir.ts
|
|
416
|
+
async function generateBaseTypesDir(runtimeDistDir, fs) {
|
|
417
|
+
const baseTypesDir = path15__namespace.join(runtimeDistDir, "baseTypes");
|
|
418
|
+
await fs.mkdir(baseTypesDir, {
|
|
419
|
+
recursive: true
|
|
420
|
+
});
|
|
421
|
+
await fs.writeFile(path15__namespace.join(baseTypesDir, "index.ts"), await formatTs(`export * from "./ActionType";
|
|
138
422
|
export * from "./attachments";
|
|
139
423
|
export * from "./geoshapes";
|
|
140
424
|
export * from "./links";
|
|
@@ -144,9 +428,41 @@ function B(e){return {...e,actionTypes:Object.fromEntries(Object.values(e.action
|
|
|
144
428
|
export * from "./OntologyObject";
|
|
145
429
|
export * from "./Queries";
|
|
146
430
|
export * from "./timeseries";
|
|
147
|
-
export * from "./timestamp";`));
|
|
148
|
-
|
|
149
|
-
|
|
431
|
+
export * from "./timestamp";`));
|
|
432
|
+
const geoshapesDir = path15__namespace.join(baseTypesDir, "geoshapes");
|
|
433
|
+
await generateGeoshapesDir(geoshapesDir, fs);
|
|
434
|
+
const timeseriesDir = path15__namespace.join(baseTypesDir, "timeseries");
|
|
435
|
+
await generateTimeSeriesDir(timeseriesDir, fs);
|
|
436
|
+
const attachmentsDir = path15__namespace.join(baseTypesDir, "attachments");
|
|
437
|
+
await generateAttachmentsDir(attachmentsDir, fs);
|
|
438
|
+
const objectSetDir = path15__namespace.join(baseTypesDir, "objectset");
|
|
439
|
+
await generateObjectSetDir(objectSetDir, fs);
|
|
440
|
+
const sharedObjectCodeDir = path15__namespace.join(baseTypesDir, "sharedObjectCode");
|
|
441
|
+
await generateSharedObjectCodeDir(sharedObjectCodeDir, fs);
|
|
442
|
+
await fs.writeFile(path15__namespace.join(baseTypesDir, "ActionType.ts"), await formatTs(`import { OntologyObject } from "./OntologyObject";
|
|
443
|
+
` + reexportConsts(["ActionExecutionMode", "ReturnEditsMode", "ActionValidationResult"]) + reexportTypes(["ActionExecutionOptions", "ValidationResponse", "BulkEdits"]) + reexportTypes(["CreatedObjectEdits", "ModifiedObjectEdits"], "<T extends OntologyObject>") + reexportTypes(["Edits"], "<TAddedObjects extends OntologyObject | void, TModifiedObjects extends OntologyObject | void>") + reexportTypes(["ActionResponse"], "<TEdits extends Edits<any, any> | undefined = undefined>", "<TEdits>") + reexportTypes(["ActionResponseFromOptions"], "<TOptions extends ActionExecutionOptions | undefined = undefined, TEdits extends Edits<any, any> | undefined = undefined>", "<TOptions, TEdits>")));
|
|
444
|
+
await fs.writeFile(path15__namespace.join(baseTypesDir, "OntologyObject.ts"), await formatTs(reexportTypes(["OntologyObject"]) + reexportConsts(["isOntologyObject"])));
|
|
445
|
+
await fs.writeFile(path15__namespace.join(baseTypesDir, "links.ts"), await formatTs(`import { OntologyObject } from "./OntologyObject` + reexportTypes(["SingleLink", "MultiLink"], "<T extends OntologyObject = OntologyObject>")));
|
|
446
|
+
await fs.writeFile(path15__namespace.join(baseTypesDir, "localDate.ts"), await formatTs(reexportConsts(["LocalDate"]) + reexportTypes(["LocalDate"])));
|
|
447
|
+
await fs.writeFile(path15__namespace.join(baseTypesDir, "timestamp.ts"), await formatTs(reexportConsts(["Timestamp"]) + reexportTypes(["Timestamp"])));
|
|
448
|
+
await fs.writeFile(path15__namespace.join(baseTypesDir, "Queries.ts"), await formatTs(`import { BucketValue, Range, Rangeable } from "../aggregations";
|
|
449
|
+
` + reexportTypes(["QueryResponse"], "<T>") + reexportTypes(["BaseBucket"], "<K, V>") + reexportTypes(["NestedBucket"], "<TGroupKey, TSegmentKey, TValue extends BucketValue>") + reexportTypes(["TwoDimensionalAggregation"], "<TGroupKey extends QueryBucketKey, TValue extends BucketValue = number>") + reexportTypes(["ThreeDimensionalAggregation"], "<TGroupKey extends QueryBucketKey, TSegmentKey extends QueryBucketKey, TValue extends BucketValue = number>") + reexportTypes(["QueryBucketKey"])));
|
|
450
|
+
await fs.writeFile(path15__namespace.join(baseTypesDir, "ObjectType.ts"), await formatTs(`import { OntologyObject } from "./OntologyObject";` + reexportTypes(["BaseType", "StringType", "IntegerType", "DateType", "BooleanType", "ByteType", "DecimalType", "FloatType", "TimestampType", "ShortType", "LongType", "DoubleType", "GeoPointType", "GeoShapeType", "AttachmentType", "ObjectType", "StructField", "QueryBucketRangeableType", "QueryBucketKeyType", "QueryBucketValueType", "AllValueTypes", "OntologyType", "ObjectTypeProperties", "StructType"]) + reexportTypes(["TimeSeriesType", "ArrayType", "SetType"], "<T extends BaseType>") + reexportTypes(["Property"], "<TType extends OntologyType = OntologyType>") + reexportTypes(["BaseObjectType"], "<TOntologyObject extends OntologyObject = OntologyObject>") + reexportTypes(["ObjectSetType"], "<T extends ObjectType>") + reexportTypes(["RangeType"], "<T extends QueryBucketRangeableType>") + reexportTypes(["TwoDimensionalAggregationType"], "<TGroupKey extends QueryBucketKeyType, TValue extends QueryBucketValueType>") + reexportTypes(["ThreeDimensionalAggregationType"], "<TGroupKey extends QueryBucketKeyType, TSegmentKey extends QueryBucketKeyType, TValue extends QueryBucketValueType>")));
|
|
451
|
+
}
|
|
452
|
+
async function generateClientDir(runtimeDistDir, fs) {
|
|
453
|
+
const pagingDir = path15__namespace.default.join(runtimeDistDir, "client");
|
|
454
|
+
await fs.mkdir(pagingDir, {
|
|
455
|
+
recursive: true
|
|
456
|
+
});
|
|
457
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "index.ts"), await formatTs(`export * from "./clientOptions";`));
|
|
458
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "clientOptions.ts"), await formatTs(`import {Auth} from "@osdk/legacy-client";` + reexportTypes(["FoundryClientOptions"], "<TAuth extends Auth = Auth>")));
|
|
459
|
+
}
|
|
460
|
+
async function generateFiltersDir(runtimeDistDir, fs) {
|
|
461
|
+
const pagingDir = path15__namespace.default.join(runtimeDistDir, "filters");
|
|
462
|
+
await fs.mkdir(pagingDir, {
|
|
463
|
+
recursive: true
|
|
464
|
+
});
|
|
465
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "index.ts"), await formatTs(`export * from "./ArrayFilter";
|
|
150
466
|
export * from "./AttachmentFilter";
|
|
151
467
|
export * from "./BooleanFilter";
|
|
152
468
|
export * from "./DateTimeFilters";
|
|
@@ -156,28 +472,96 @@ function B(e){return {...e,actionTypes:Object.fromEntries(Object.values(e.action
|
|
|
156
472
|
export * from "./NumericFilter";
|
|
157
473
|
export * from "./Op";
|
|
158
474
|
export * from "./OrderByOption";
|
|
159
|
-
export * from "./StringFilter";`))
|
|
160
|
-
|
|
161
|
-
|
|
475
|
+
export * from "./StringFilter";`));
|
|
476
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "ArrayFilter.ts"), await formatTs(`import { Attachment, GeoPoint, GeoShape, LocalDate, Timestamp } from "../baseTypes";` + reexportConsts(["ArrayFilter"]) + reexportTypes(["ArrayFilter"], "<T extends string | number | Timestamp | LocalDate | boolean | GeoShape | GeoPoint | Attachment>")));
|
|
477
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "AttachmentFilter.ts"), await formatTs(reexportConsts(["AttachmentFilter"]) + reexportTypes(["AttachmentFilter"])));
|
|
478
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "BooleanFilter.ts"), await formatTs(reexportConsts(["BooleanFilter"]) + reexportTypes(["BooleanFilter"])));
|
|
479
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "GeoPointFilter.ts"), await formatTs(reexportConsts(["GeoPointFilter"]) + reexportTypes(["GeoPointFilter", "BoundingBox"])));
|
|
480
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "DateTimeFilters.ts"), await formatTs(reexportConsts(["TimestampFilter", "LocalDateFilter"]) + reexportTypes(["TimestampFilter", "LocalDateFilter"])));
|
|
481
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "GeoShapeFilter.ts"), await formatTs(reexportConsts(["GeoShapeFilter"]) + reexportTypes(["GeoShapeFilter"])));
|
|
482
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "NumericFilter.ts"), await formatTs(reexportConsts(["NumericFilter"]) + reexportTypes(["NumericFilter"])));
|
|
483
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "Op.ts"), await formatTs(reexportConsts(["Op"])));
|
|
484
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "OrderByOption.ts"), await formatTs(reexportConsts(["OrderByOption"]) + reexportTypes(["OrderByOption"])));
|
|
485
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "StringFilter.ts"), await formatTs(reexportConsts(["StringFilter"]) + reexportTypes(["StringFilter"])));
|
|
486
|
+
await fs.writeFile(path15__namespace.default.join(pagingDir, "Filters.ts"), await formatTs(`import { OntologyObject } from "@osdk/legacy-client";` + reexportTypes(["ObjectTypeFilterFunction", "ObjectTypeOrderByFunction"], "<T extends OntologyObject>") + reexportTypes(["BoundingBoxFilter", "DistanceOf", "SearchClause", "LtWhereClause", "GtWhereClause", "LteWhereClause", "GteWhereClause", "EqWhereClause", "IsNullWhereClause", "ContainsWhereClause", "StartsWithWhereClause", "ContainsAllTermsInOrderWhereClause", "ContainsAnyTermWhereClause", "ContainsAllTermsWhereClause", "WithinDistanceOfWhereClause", "WithinBoundingBoxWhereClause", "IntersectsBoundingBoxWhereClause", "DoesNotIntersectBoundingBoxWhereClause", "WithinPolygonWhereClause", "IntersectsPolygonWhereClause", "DoesNotIntersectPolygonWhereClause", "AndWhereClause", "OrWhereClause", "NotWhereClause", "WhereClause", "OrderByClause"]) + reexportTypes(["FilterType"], "<T extends string | number>")));
|
|
487
|
+
}
|
|
488
|
+
async function generateErrors(fs, ontologyProviderDir) {
|
|
489
|
+
await fs.writeFile(path15__namespace.join(ontologyProviderDir, "Errors.ts"), await formatTs(reexportTypes(["PermissionDenied", "Unauthorized", "InvalidAggregationRangeValue", "MalformedPropertyFilters", "PropertiesNotFilterable", "ParametersNotFound", "ApplyActionFailed", "PropertyTypesSearchNotSupported", "InvalidParameterValue", "QueryTimeExceededLimit", "CompositePrimaryKeyNotSupported", "PropertyBaseTypeNotSupported", "PropertiesNotSearchable", "AttachmentNotFound", "ObjectTypeNotFound", "InvalidGroupId", "OntologySyncing", "ActionNotFound", "ParameterObjectSetRidNotFound", "LinkTypeNotFound", "InvalidRangeQuery", "ActionParameterObjectNotFound", "InvalidPropertyValue", "PropertiesNotSortable", "FunctionExecutionTimedOut", "InvalidFields", "ActionTypeNotFound", "ObjectTypeNotSynced", "OntologyEditsExceededLimit", "AggregationGroupCountExceededLimit", "InvalidContentType", "PropertiesNotFound", "FunctionInvalidInput", "InvalidSortOrder", "QueryDepthExceededLimit", "InvalidPropertyFiltersCombination", "ObjectsExceededLimit", "DuplicateOrderBy", "FunctionEncounteredUserFacingError", "InvalidUserId", "QueryNotFound", "InvalidAggregationRange", "ParameterObjectNotFound", "QueryMemoryExceededLimit", "InvalidContentLength", "OntologyNotFound", "ActionParameterObjectTypeNotFound", "UnknownParameter", "InvalidSortType", "PropertyFiltersNotSupported", "ActionValidationFailed", "MultipleGroupByOnFieldNotSupported", "LinkedObjectNotFound", "ActionEditedPropertiesNotFound", "InvalidPropertyFilterValue", "QueryEncounteredUserFacingError", "AttachmentSizeExceededLimit", "ObjectNotFound", "PropertyApiNameNotFound", "ParameterTypeNotSupported", "InvalidAggregationRangePropertyType", "MissingParameter"])));
|
|
490
|
+
}
|
|
491
|
+
async function generateOntologyMetadata(fs, ontologyProviderDir) {
|
|
492
|
+
await fs.writeFile(path15__namespace.join(ontologyProviderDir, "OntologyMetadata.ts"), await formatTs(reexportTypes(["OntologyMetadata"])));
|
|
493
|
+
}
|
|
494
|
+
async function generateResult(fs, ontologyProviderDir) {
|
|
495
|
+
await fs.writeFile(path15__namespace.join(ontologyProviderDir, "Result.ts"), await formatTs(`import {FoundryApiError} from "@osdk/legacy-client";
|
|
496
|
+
` + reexportTypes(["Ok", "Err"], "<T>") + reexportTypes(["Result"], "<V, E = FoundryApiError>", "<V,E>") + reexportConsts(["isOk", "isErr", "visitError"]) + reexportTypes(["ErrorVisitor"], "<E extends FoundryApiError, R>", "<E,R>") + reexportTypes(["ExtractKeysWithType"], "<T, K extends keyof T>", "<T,K>")));
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// src/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateOntologyProviderDir.ts
|
|
500
|
+
async function generateOntologyProviderDir(fs, runtimeDistDir) {
|
|
501
|
+
const ontologyProviderDir = path15__namespace.join(runtimeDistDir, "ontologyProvider");
|
|
502
|
+
await fs.mkdir(ontologyProviderDir, {
|
|
503
|
+
recursive: true
|
|
504
|
+
});
|
|
505
|
+
await generateErrors(fs, ontologyProviderDir);
|
|
506
|
+
await generateOntologyMetadata(fs, ontologyProviderDir);
|
|
507
|
+
await generateResult(fs, ontologyProviderDir);
|
|
508
|
+
await fs.writeFile(path15__namespace.join(ontologyProviderDir, "index.ts"), await formatTs(`
|
|
509
|
+
${""}
|
|
162
510
|
export * from "./Errors";
|
|
163
511
|
export * from "./OntologyMetadata";
|
|
164
|
-
|
|
165
|
-
|
|
512
|
+
${""}
|
|
513
|
+
${""}
|
|
166
514
|
// export * from "./Result";
|
|
167
|
-
`));
|
|
515
|
+
`));
|
|
516
|
+
}
|
|
517
|
+
async function generatePagingDir(runtimeDistDir, fs) {
|
|
518
|
+
const pagingDir = path15__namespace.join(runtimeDistDir, "paging");
|
|
519
|
+
await fs.mkdir(pagingDir, {
|
|
520
|
+
recursive: true
|
|
521
|
+
});
|
|
522
|
+
await fs.writeFile(path15__namespace.join(pagingDir, "index.ts"), await formatTs(`export * from "./Page";`));
|
|
523
|
+
await fs.writeFile(path15__namespace.join(pagingDir, "Page.ts"), await formatTs(reexportTypes(["Page"], "<T>")));
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// src/v1.1/backcompat/generateOntologyRuntimeDistDir.ts
|
|
527
|
+
async function generateOntologyRuntimeDistDir(outDir, fs) {
|
|
528
|
+
const runtimeDistDir = path15__namespace.join(outDir, "internal", "@foundry", "ontology-runtime", "dist");
|
|
529
|
+
await fs.mkdir(runtimeDistDir, {
|
|
530
|
+
recursive: true
|
|
531
|
+
});
|
|
532
|
+
await generateOntologyProviderDir(fs, runtimeDistDir);
|
|
533
|
+
await generateAggregationsDir(fs, runtimeDistDir);
|
|
534
|
+
await generatePagingDir(runtimeDistDir, fs);
|
|
535
|
+
await generateBaseTypesDir(runtimeDistDir, fs);
|
|
536
|
+
await generateClientDir(runtimeDistDir, fs);
|
|
537
|
+
await generateFiltersDir(runtimeDistDir, fs);
|
|
538
|
+
await fs.writeFile(
|
|
539
|
+
path15__namespace.join(runtimeDistDir, "index.ts"),
|
|
540
|
+
// TRASHFIXME
|
|
541
|
+
await formatTs(`
|
|
168
542
|
export * from "./aggregations";
|
|
169
543
|
export * from "./baseTypes";
|
|
170
|
-
|
|
544
|
+
${""}
|
|
171
545
|
// export * from "./filters";
|
|
172
|
-
|
|
173
|
-
|
|
546
|
+
${""}
|
|
547
|
+
${""}
|
|
174
548
|
|
|
175
549
|
export * from "./ontologyProvider";
|
|
176
550
|
export * from "./paging";
|
|
177
|
-
`)
|
|
551
|
+
`)
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// src/v1.1/generateBackCompatDeprecatedExports.ts
|
|
556
|
+
async function generateBackCompatDeprecatedExports(fs, outDir) {
|
|
557
|
+
await generateOntologyRuntimeDistDir(outDir, fs);
|
|
558
|
+
await generateOAuthClientDistDir(outDir, fs);
|
|
559
|
+
}
|
|
560
|
+
async function generateFoundryClientFile(fs, outDir, importExt = "") {
|
|
561
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "FoundryClient.ts"), await formatTs(`
|
|
178
562
|
import { BaseFoundryClient } from "@osdk/legacy-client";
|
|
179
563
|
import type { Auth, FoundryClientOptions } from "@osdk/legacy-client";
|
|
180
|
-
import { Ontology } from "./Ontology${
|
|
564
|
+
import { Ontology } from "./Ontology${importExt}";
|
|
181
565
|
|
|
182
566
|
export class FoundryClient<TAuth extends Auth = Auth> extends BaseFoundryClient<typeof Ontology, TAuth> {
|
|
183
567
|
constructor(options: FoundryClientOptions<TAuth>) {
|
|
@@ -187,200 +571,1044 @@ function B(e){return {...e,actionTypes:Object.fromEntries(Object.values(e.action
|
|
|
187
571
|
get ontology(): Ontology {
|
|
188
572
|
return super.ontology;
|
|
189
573
|
}
|
|
190
|
-
}`));
|
|
574
|
+
}`));
|
|
575
|
+
}
|
|
576
|
+
async function generateIndexFile(fs, outDir, importExt) {
|
|
577
|
+
await fs.mkdir(outDir, {
|
|
578
|
+
recursive: true
|
|
579
|
+
});
|
|
580
|
+
await fs.writeFile(path15__namespace.join(outDir, "index.ts"), await formatTs(`
|
|
191
581
|
export * from "@osdk/legacy-client";
|
|
192
|
-
export type { Ontology } from "./Ontology${
|
|
193
|
-
export { FoundryClient } from "./FoundryClient${
|
|
194
|
-
`));
|
|
582
|
+
export type { Ontology } from "./Ontology${importExt}";
|
|
583
|
+
export { FoundryClient } from "./FoundryClient${importExt}";
|
|
584
|
+
`));
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// src/util/commaSeparatedIdentifiers.ts
|
|
588
|
+
function commaSeparatedIdentifiers(identifiers, alternateNames) {
|
|
589
|
+
return identifiers.map((i) => {
|
|
590
|
+
const alt = alternateNames?.get(i);
|
|
591
|
+
if (alt) {
|
|
592
|
+
return `${i}: ${alt}`;
|
|
593
|
+
}
|
|
594
|
+
return i;
|
|
595
|
+
}).join(",");
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// src/util/commaSeparatedTypeIdentifiers.ts
|
|
599
|
+
function commaSeparatedTypeIdentifiers(identifiers, altNames) {
|
|
600
|
+
return identifiers.map((i) => `${i}: typeof ${altNames?.get(i) ?? i}`).join(",");
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// src/v1.1/generateMetadataFile.ts
|
|
604
|
+
async function generateMetadataFile(ontology, fs, outDir, importExt = "") {
|
|
605
|
+
const objectNames = Object.keys(ontology.objectTypes);
|
|
606
|
+
const actionNames = Object.keys(ontology.actionTypes);
|
|
607
|
+
const queryNames = Object.keys(ontology.queryTypes);
|
|
608
|
+
const actionAltNames = /* @__PURE__ */ new Map();
|
|
609
|
+
const queryAltNames = /* @__PURE__ */ new Map();
|
|
610
|
+
const seenIdentifiers = new Set(objectNames);
|
|
611
|
+
for (const actionName of actionNames) {
|
|
612
|
+
if (seenIdentifiers.has(actionName)) {
|
|
613
|
+
actionAltNames.set(actionName, `${actionName}Action`);
|
|
614
|
+
} else {
|
|
615
|
+
seenIdentifiers.add(actionName);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
for (const queryName of queryNames) {
|
|
619
|
+
if (seenIdentifiers.has(queryName)) {
|
|
620
|
+
queryAltNames.set(queryName, `${queryName}Query`);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
const getImportClause = (name, altNames) => {
|
|
624
|
+
const alt = altNames.get(name);
|
|
625
|
+
if (alt) {
|
|
626
|
+
return `${name} as ${alt}`;
|
|
627
|
+
} else {
|
|
628
|
+
return name;
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "Ontology.ts"), await formatTs(`
|
|
195
632
|
import type { OntologyDefinition } from "@osdk/api";
|
|
196
633
|
import type { Ontology as ClientOntology } from "@osdk/legacy-client";
|
|
197
|
-
import type { Objects } from "./ontology/objects/Objects${
|
|
198
|
-
import type { Actions } from "./ontology/actions/Actions${
|
|
199
|
-
import type { Queries } from "./ontology/queries/Queries${
|
|
200
|
-
${
|
|
201
|
-
`)}
|
|
202
|
-
${
|
|
203
|
-
`)}
|
|
204
|
-
${c.map(p=>`import {${w(p,u)}} from "./ontology/queries/${p}${n}";`).join(`
|
|
205
|
-
`)}
|
|
634
|
+
import type { Objects } from "./ontology/objects/Objects${importExt}";
|
|
635
|
+
import type { Actions } from "./ontology/actions/Actions${importExt}";
|
|
636
|
+
import type { Queries } from "./ontology/queries/Queries${importExt}";
|
|
637
|
+
${objectNames.map((name) => `import {${name}} from "./ontology/objects/${name}${importExt}";`).join("\n")}
|
|
638
|
+
${actionNames.map((name) => `import {${getImportClause(name, actionAltNames)}} from "./ontology/actions/${name}${importExt}";`).join("\n")}
|
|
639
|
+
${queryNames.map((name) => `import {${getImportClause(name, queryAltNames)}} from "./ontology/queries/${name}${importExt}";`).join("\n")}
|
|
206
640
|
|
|
207
641
|
export const Ontology : {
|
|
208
642
|
metadata: {
|
|
209
|
-
ontologyRid: "${
|
|
210
|
-
ontologyApiName: "${
|
|
643
|
+
ontologyRid: "${ontology.ontology.rid}",
|
|
644
|
+
ontologyApiName: "${ontology.ontology.apiName}",
|
|
211
645
|
userAgent: "foundry-typescript-osdk/0.0.1",
|
|
212
646
|
},
|
|
213
647
|
objects: {
|
|
214
|
-
${
|
|
648
|
+
${commaSeparatedTypeIdentifiers(objectNames)}
|
|
215
649
|
},
|
|
216
650
|
actions: {
|
|
217
|
-
${
|
|
651
|
+
${commaSeparatedTypeIdentifiers(actionNames, actionAltNames)}
|
|
218
652
|
},
|
|
219
653
|
queries: {
|
|
220
|
-
${
|
|
654
|
+
${commaSeparatedTypeIdentifiers(queryNames, queryAltNames)}
|
|
221
655
|
},
|
|
222
656
|
} = {
|
|
223
657
|
metadata: {
|
|
224
|
-
ontologyRid: "${
|
|
225
|
-
ontologyApiName: "${
|
|
658
|
+
ontologyRid: "${ontology.ontology.rid}" as const,
|
|
659
|
+
ontologyApiName: "${ontology.ontology.apiName}" as const,
|
|
226
660
|
userAgent: "foundry-typescript-osdk/0.0.1" as const,
|
|
227
661
|
},
|
|
228
662
|
objects: {
|
|
229
|
-
${
|
|
663
|
+
${commaSeparatedIdentifiers(objectNames)}
|
|
230
664
|
},
|
|
231
665
|
actions: {
|
|
232
|
-
${
|
|
666
|
+
${commaSeparatedIdentifiers(actionNames, actionAltNames)}
|
|
233
667
|
},
|
|
234
668
|
queries: {
|
|
235
|
-
${
|
|
669
|
+
${commaSeparatedIdentifiers(queryNames, queryAltNames)}
|
|
236
670
|
}
|
|
237
|
-
} satisfies OntologyDefinition
|
|
671
|
+
} satisfies OntologyDefinition<
|
|
672
|
+
${stringUnionFrom(objectNames)},
|
|
673
|
+
${stringUnionFrom(Object.values(ontology.actionTypes).map((actionType) => actionType.apiName))},
|
|
674
|
+
${stringUnionFrom(Object.values(ontology.queryTypes).map((queryType) => queryType.apiName))}>;
|
|
238
675
|
|
|
239
676
|
export interface Ontology extends ClientOntology<typeof Ontology> {
|
|
240
677
|
objects: Objects;
|
|
241
678
|
actions: Actions;
|
|
242
679
|
queries: Queries;
|
|
243
|
-
}`));
|
|
680
|
+
}`));
|
|
681
|
+
}
|
|
682
|
+
function stringUnionFrom(values) {
|
|
683
|
+
if (values.length === 0) {
|
|
684
|
+
return "never";
|
|
685
|
+
}
|
|
686
|
+
return values.map((n) => `"${n}"`).join("|");
|
|
687
|
+
}
|
|
688
|
+
async function generateObjectsInterfaceFile(ontology, fs, outDir, importExt = "") {
|
|
689
|
+
await fs.mkdir(outDir, {
|
|
690
|
+
recursive: true
|
|
691
|
+
});
|
|
692
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "Objects.ts"), await formatTs(`
|
|
244
693
|
import { BaseObjectSet } from "@osdk/legacy-client";
|
|
245
|
-
${Array.from(Object.keys(
|
|
246
|
-
`)}
|
|
694
|
+
${Array.from(Object.keys(ontology.objectTypes)).map((importedObject) => `import type { ${importedObject} } from "./${importedObject}${importExt}";`).join("\n")}
|
|
247
695
|
|
|
248
696
|
export interface Objects {
|
|
249
|
-
${Object.keys(
|
|
250
|
-
`)}
|
|
697
|
+
${Object.keys(ontology.objectTypes).map((apiName) => `${apiName} : BaseObjectSet<${apiName}>;`).join("\n")}
|
|
251
698
|
}
|
|
252
|
-
;`));
|
|
699
|
+
;`));
|
|
700
|
+
}
|
|
701
|
+
async function generateObjectsInterfaceSupportFiles(ontology, fs, outDir, importExt = "") {
|
|
702
|
+
await fs.mkdir(outDir, {
|
|
703
|
+
recursive: true
|
|
704
|
+
});
|
|
705
|
+
for (const {
|
|
706
|
+
objectType: {
|
|
707
|
+
apiName
|
|
708
|
+
}
|
|
709
|
+
} of Object.values(ontology.objectTypes)) {
|
|
710
|
+
const fileName = path15.join(outDir, `${apiName}.ts`);
|
|
711
|
+
const localApiName = `OG_${apiName}`;
|
|
712
|
+
const contents = [];
|
|
713
|
+
contents.push(`import { ObjectSetAggregateArg, ObjectSetFilterArg, ObjectSetGroupByArg, ObjectSetMultipleAggregateArg, ObjectSetOrderByArg } from "@osdk/legacy-client";`);
|
|
714
|
+
contents.push(`import { ${apiName} as ${localApiName} } from "../${apiName}${importExt}";`);
|
|
715
|
+
contents.push("");
|
|
716
|
+
contents.push(`/** @deprecated Use ${apiName} from ontology/objects instead */`, `export type ${apiName} = ${localApiName};`);
|
|
717
|
+
contents.push(`/** @deprecated Use ObjectSetFilterArg<${apiName}> instead */`, `export type ${apiName}Filter = ObjectSetFilterArg<${localApiName}>;`);
|
|
718
|
+
contents.push(`/** @deprecated Use ObjectSetOrderByArg<${apiName}> instead */`, `export type ${apiName}OrderBy = ObjectSetOrderByArg<${localApiName}>;`);
|
|
719
|
+
contents.push(`/** @deprecated Use ObjectSetGroupByArg<${apiName}> instead */`, `export type ${apiName}GroupByProperties = ObjectSetGroupByArg<${localApiName}>;`);
|
|
720
|
+
contents.push(`
|
|
253
721
|
/**
|
|
254
|
-
* Aggregation properties for ${
|
|
255
|
-
* @deprecated Use ObjectSetAggregateArg<${
|
|
256
|
-
|
|
722
|
+
* Aggregation properties for ${apiName}
|
|
723
|
+
* @deprecated Use ObjectSetAggregateArg<${apiName}> instead
|
|
724
|
+
*/`, `export type ${apiName}AggregationProperties = ObjectSetAggregateArg<${localApiName}>;`);
|
|
725
|
+
contents.push(`
|
|
257
726
|
/**
|
|
258
|
-
* Multiple aggregation properties for ${
|
|
259
|
-
* @deprecated Use ObjectSetMultipleAggregateArg<${
|
|
260
|
-
|
|
261
|
-
|
|
727
|
+
* Multiple aggregation properties for ${apiName}.
|
|
728
|
+
* @deprecated Use ObjectSetMultipleAggregateArg<${apiName}> instead
|
|
729
|
+
*/`, `export type ${apiName}MultipleAggregationProperties = ObjectSetMultipleAggregateArg<${localApiName}>;`);
|
|
730
|
+
await fs.writeFile(fileName, contents.join("\n"));
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
async function generateOntologyIndexFile(fs, outDir) {
|
|
734
|
+
await fs.mkdir(outDir, {
|
|
735
|
+
recursive: true
|
|
736
|
+
});
|
|
737
|
+
await fs.writeFile(path15__namespace.join(outDir, "index.ts"), await formatTs(`
|
|
262
738
|
export type { ObjectSet } from "@osdk/legacy-client";
|
|
263
|
-
`));
|
|
739
|
+
`));
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// src/shared/wireActionTypeV2ToSdkActionDefinition.ts
|
|
743
|
+
function wireActionTypeV2ToSdkActionDefinition(input) {
|
|
744
|
+
const modifiedEntityTypes = getModifiedEntityTypes(input);
|
|
745
|
+
return {
|
|
746
|
+
apiName: input.apiName,
|
|
747
|
+
parameters: Object.fromEntries(Object.entries(input.parameters).map(([key, value]) => [key, wireActionParameterV2ToSdkParameterDefinition(value)])),
|
|
748
|
+
displayName: input.displayName,
|
|
749
|
+
description: input.description,
|
|
750
|
+
modifiedEntities: createModifiedEntities(modifiedEntityTypes.addedObjects, modifiedEntityTypes.modifiedObjects)
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
function wireActionParameterV2ToSdkParameterDefinition(value) {
|
|
754
|
+
switch (value.dataType.type) {
|
|
755
|
+
case "string":
|
|
756
|
+
case "boolean":
|
|
757
|
+
case "object":
|
|
758
|
+
case "attachment":
|
|
759
|
+
case "date":
|
|
760
|
+
case "double":
|
|
761
|
+
case "integer":
|
|
762
|
+
case "long":
|
|
763
|
+
case "objectSet":
|
|
764
|
+
case "timestamp":
|
|
765
|
+
return {
|
|
766
|
+
multiplicity: false,
|
|
767
|
+
type: actionPropertyToSdkPropertyDefinition(value.dataType),
|
|
768
|
+
nullable: value.required ? false : true,
|
|
769
|
+
description: value.description
|
|
770
|
+
};
|
|
771
|
+
case "array":
|
|
772
|
+
return {
|
|
773
|
+
multiplicity: true,
|
|
774
|
+
type: actionPropertyToSdkPropertyDefinition(value.dataType),
|
|
775
|
+
nullable: value.required ? false : true,
|
|
776
|
+
description: value.description
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
function actionPropertyToSdkPropertyDefinition(parameterType) {
|
|
781
|
+
switch (parameterType.type) {
|
|
782
|
+
case "string":
|
|
783
|
+
case "boolean":
|
|
784
|
+
case "attachment":
|
|
785
|
+
case "double":
|
|
786
|
+
case "integer":
|
|
787
|
+
case "long":
|
|
788
|
+
case "timestamp":
|
|
789
|
+
return parameterType.type;
|
|
790
|
+
case "date":
|
|
791
|
+
return "datetime";
|
|
792
|
+
case "objectSet":
|
|
793
|
+
return {
|
|
794
|
+
type: "objectSet",
|
|
795
|
+
objectSet: parameterType.objectTypeApiName
|
|
796
|
+
};
|
|
797
|
+
case "object":
|
|
798
|
+
return {
|
|
799
|
+
type: "object",
|
|
800
|
+
object: parameterType.objectTypeApiName
|
|
801
|
+
};
|
|
802
|
+
case "array":
|
|
803
|
+
return actionPropertyToSdkPropertyDefinition(parameterType.subType);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
function createModifiedEntities(addedObjects, modifiedObjects) {
|
|
807
|
+
let entities = {};
|
|
808
|
+
for (const key of addedObjects) {
|
|
809
|
+
entities[key] = {
|
|
810
|
+
created: true,
|
|
811
|
+
modified: false
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
for (const key of modifiedObjects) {
|
|
815
|
+
if (entities[key]) {
|
|
816
|
+
entities[key].modified = true;
|
|
817
|
+
} else {
|
|
818
|
+
entities[key] = {
|
|
819
|
+
created: false,
|
|
820
|
+
modified: true
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
return entities;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
// src/v1.1/generatePerActionDataFiles.ts
|
|
828
|
+
async function generatePerActionDataFiles(ontology, fs, outDir, importExt = "") {
|
|
829
|
+
await fs.mkdir(outDir, {
|
|
830
|
+
recursive: true
|
|
831
|
+
});
|
|
832
|
+
await Promise.all(Object.values(ontology.actionTypes).map(async (action) => {
|
|
833
|
+
const uniqueApiNames = new Set(extractReferencedObjectsFromAction(action));
|
|
834
|
+
await fs.writeFile(path15__namespace.default.join(outDir, `${action.apiName}.ts`), await formatTs(`
|
|
264
835
|
import { ActionDefinition } from "@osdk/api";
|
|
265
836
|
|
|
266
|
-
export const ${
|
|
267
|
-
|
|
268
|
-
`)
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
837
|
+
export const ${action.apiName} = ${JSON.stringify(wireActionTypeV2ToSdkActionDefinition(action), null, 2)} satisfies ActionDefinition<"${action.apiName}", ${uniqueApiNames.size > 0 ? [...uniqueApiNames].map((apiName) => `"${apiName}"`).join("|") : "never"}>;`));
|
|
838
|
+
}));
|
|
839
|
+
await fs.writeFile(path15__namespace.default.join(outDir, `index.ts`), await formatTs(`
|
|
840
|
+
${Object.values(ontology.actionTypes).map((action) => `export * from "./${action.apiName}${importExt}";`).join("\n")}
|
|
841
|
+
`));
|
|
842
|
+
}
|
|
843
|
+
function extractReferencedObjectsFromAction(actionType) {
|
|
844
|
+
const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({
|
|
845
|
+
dataType
|
|
846
|
+
}) => {
|
|
847
|
+
const objectTypeReference = extractReferencedObjectsFromActionParameter(dataType);
|
|
848
|
+
return objectTypeReference ? [objectTypeReference] : [];
|
|
849
|
+
});
|
|
850
|
+
const referenceObjectsInEdits = actionType.operations.flatMap((value) => {
|
|
851
|
+
switch (value.type) {
|
|
852
|
+
case "createObject":
|
|
853
|
+
return [value.objectTypeApiName];
|
|
854
|
+
case "modifyObject":
|
|
855
|
+
return [value.objectTypeApiName];
|
|
856
|
+
case "deleteObject":
|
|
857
|
+
case "createLink":
|
|
858
|
+
case "deleteLink":
|
|
859
|
+
return [];
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
return [...referenceObjectsInEdits, ...referencedObjectsInParameters];
|
|
863
|
+
}
|
|
864
|
+
function extractReferencedObjectsFromActionParameter(actionParameter) {
|
|
865
|
+
switch (actionParameter.type) {
|
|
866
|
+
case "objectSet":
|
|
867
|
+
case "object":
|
|
868
|
+
return actionParameter.objectTypeApiName;
|
|
869
|
+
case "array":
|
|
870
|
+
return extractReferencedObjectsFromActionParameter(actionParameter.subType);
|
|
871
|
+
case "string":
|
|
872
|
+
case "boolean":
|
|
873
|
+
case "attachment":
|
|
874
|
+
case "date":
|
|
875
|
+
case "double":
|
|
876
|
+
case "integer":
|
|
877
|
+
case "long":
|
|
878
|
+
case "timestamp":
|
|
879
|
+
return void 0;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
// src/shared/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts
|
|
884
|
+
function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
|
|
885
|
+
switch (input.dataType.type) {
|
|
886
|
+
case "integer":
|
|
887
|
+
case "double":
|
|
888
|
+
case "string":
|
|
889
|
+
case "boolean":
|
|
890
|
+
case "attachment":
|
|
891
|
+
case "byte":
|
|
892
|
+
case "decimal":
|
|
893
|
+
case "float":
|
|
894
|
+
case "geopoint":
|
|
895
|
+
case "geoshape":
|
|
896
|
+
case "long":
|
|
897
|
+
case "short": {
|
|
898
|
+
return input.dataType.type;
|
|
899
|
+
}
|
|
900
|
+
case "date": {
|
|
901
|
+
return "datetime";
|
|
902
|
+
}
|
|
903
|
+
case "timestamp": {
|
|
904
|
+
return "timestamp";
|
|
905
|
+
}
|
|
906
|
+
case "timeseries":
|
|
907
|
+
case "array":
|
|
908
|
+
throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
|
|
909
|
+
default:
|
|
910
|
+
input.dataType;
|
|
911
|
+
throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// src/shared/wirePropertyV2ToSdkPropertyDefinition.ts
|
|
916
|
+
function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
|
|
917
|
+
switch (input.dataType.type) {
|
|
918
|
+
case "integer":
|
|
919
|
+
case "string":
|
|
920
|
+
case "byte":
|
|
921
|
+
case "decimal":
|
|
922
|
+
case "double":
|
|
923
|
+
case "float":
|
|
924
|
+
case "long":
|
|
925
|
+
case "short":
|
|
926
|
+
case "boolean":
|
|
927
|
+
case "date":
|
|
928
|
+
case "attachment":
|
|
929
|
+
case "geopoint":
|
|
930
|
+
case "geoshape":
|
|
931
|
+
case "timestamp":
|
|
932
|
+
case "timeseries":
|
|
933
|
+
return {
|
|
934
|
+
multiplicity: false,
|
|
935
|
+
description: input.description,
|
|
936
|
+
type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
|
|
937
|
+
nullable: isNullable
|
|
938
|
+
};
|
|
939
|
+
case "array": {
|
|
940
|
+
return {
|
|
941
|
+
multiplicity: true,
|
|
942
|
+
description: input.description,
|
|
943
|
+
type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
|
|
944
|
+
nullable: true
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
default:
|
|
948
|
+
input.dataType;
|
|
949
|
+
throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
|
|
953
|
+
switch (propertyType.type) {
|
|
954
|
+
case "integer":
|
|
955
|
+
case "string":
|
|
956
|
+
case "byte":
|
|
957
|
+
case "decimal":
|
|
958
|
+
case "double":
|
|
959
|
+
case "float":
|
|
960
|
+
case "long":
|
|
961
|
+
case "short":
|
|
962
|
+
case "boolean":
|
|
963
|
+
case "attachment":
|
|
964
|
+
case "geopoint":
|
|
965
|
+
case "geoshape":
|
|
966
|
+
case "timestamp":
|
|
967
|
+
return propertyType.type;
|
|
968
|
+
case "date":
|
|
969
|
+
return "datetime";
|
|
970
|
+
case "array":
|
|
971
|
+
return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);
|
|
972
|
+
case "timeseries":
|
|
973
|
+
if (propertyType.itemType.type === "string") {
|
|
974
|
+
return "stringTimeseries";
|
|
975
|
+
}
|
|
976
|
+
return "numericTimeseries";
|
|
977
|
+
default:
|
|
978
|
+
throw new Error(`Unexecpected data type ${propertyType}`);
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
// src/shared/wireObjectTypeV2ToSdkObjectDefinition.ts
|
|
983
|
+
function wireObjectTypeV2ToSdkObjectDefinition(objectTypeWithLink, v2) {
|
|
984
|
+
if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === void 0) {
|
|
985
|
+
throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);
|
|
986
|
+
}
|
|
987
|
+
return {
|
|
988
|
+
apiName: objectTypeWithLink.objectType.apiName,
|
|
989
|
+
description: objectTypeWithLink.objectType.description,
|
|
990
|
+
primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),
|
|
991
|
+
links: Object.fromEntries(objectTypeWithLink.linkTypes.map((linkType) => {
|
|
992
|
+
return [linkType.apiName, {
|
|
993
|
+
multiplicity: linkType.cardinality === "MANY",
|
|
994
|
+
targetType: linkType.objectTypeApiName
|
|
995
|
+
}];
|
|
996
|
+
})),
|
|
997
|
+
properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))]))
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
// src/shared/wireObjectTypeV2ToSdkObjectConst.ts
|
|
1002
|
+
function wireObjectTypeV2ToSdkObjectConst(object, v2 = false) {
|
|
1003
|
+
const uniqueLinkTargetTypes = new Set(object.linkTypes.map((a) => a.objectTypeApiName));
|
|
1004
|
+
return `
|
|
1005
|
+
export const ${object.objectType.apiName} = ${JSON.stringify(wireObjectTypeV2ToSdkObjectDefinition(object, v2), null, 2)} satisfies ObjectTypeDefinition<"${object.objectType.apiName}", ${uniqueLinkTargetTypes.size > 0 ? [...uniqueLinkTargetTypes].map((apiName) => `"${apiName}"`).join("|") : "never"}>;`;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// src/util/reservedKeywords.ts
|
|
1009
|
+
var reservedKeywords = /* @__PURE__ */ new Set(["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export", "extends", "false", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "null", "return", "super", "switch", "this", "throw", "true", "try", "typeof", "var", "void", "while", "with", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"]);
|
|
1010
|
+
function isReservedKeyword(name) {
|
|
1011
|
+
return reservedKeywords.has(name);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts
|
|
1015
|
+
function wireObjectTypeV2ToObjectInterfaceStringV1(objectTypeWithLinks) {
|
|
1016
|
+
const uniqueLinkTargets = new Set(objectTypeWithLinks.linkTypes.map((a) => a.objectTypeApiName).filter((a) => a !== objectTypeWithLinks.objectType.apiName));
|
|
1017
|
+
return `import type { OntologyObject, LocalDate, Timestamp, GeoShape, GeoPoint, Attachment, TimeSeries, MultiLink, SingleLink } from "@osdk/legacy-client";
|
|
1018
|
+
${Array.from(uniqueLinkTargets).map((linkTarget) => `import type { ${linkTarget} } from "./${linkTarget}";`).join("\n")}
|
|
1019
|
+
|
|
1020
|
+
${getDescriptionIfPresent(objectTypeWithLinks.objectType.description)}export interface ${objectTypeWithLinks.objectType.apiName} extends OntologyObject {
|
|
1021
|
+
readonly __apiName: "${objectTypeWithLinks.objectType.apiName}";
|
|
1022
|
+
readonly __primaryKey: ${wirePropertyTypeV2ToTypeScriptType(objectTypeWithLinks.objectType.properties[objectTypeWithLinks.objectType.primaryKey].dataType)};
|
|
1023
|
+
${Object.entries(objectTypeWithLinks.objectType.properties).flatMap(([propertyName, propertyDefinition]) => {
|
|
1024
|
+
const propertyType = wirePropertyTypeV2ToTypeScriptType(propertyDefinition.dataType);
|
|
1025
|
+
const entries = [`${getDescriptionIfPresent(propertyDefinition.description)}readonly ${propertyName}: ${propertyType} | undefined`];
|
|
1026
|
+
if (isReservedKeyword(propertyName)) {
|
|
1027
|
+
entries.push(`/** @deprecated please migrate to '${propertyName}' instead */
|
|
1028
|
+
readonly ${propertyName}_: ${propertyType} | undefined`);
|
|
1029
|
+
}
|
|
1030
|
+
return entries;
|
|
1031
|
+
}).join(";\n")}
|
|
1032
|
+
${objectTypeWithLinks.linkTypes.flatMap((linkType) => {
|
|
1033
|
+
const entries = [`readonly ${linkType.apiName}: ${linkType.cardinality === "MANY" ? "MultiLink" : "SingleLink"}<${linkType.objectTypeApiName}>`];
|
|
1034
|
+
return entries;
|
|
1035
|
+
}).join(";\n")}
|
|
1036
|
+
}
|
|
1037
|
+
`;
|
|
1038
|
+
}
|
|
1039
|
+
function wirePropertyTypeV2ToTypeScriptType(property) {
|
|
1040
|
+
switch (property.type) {
|
|
1041
|
+
case "string":
|
|
1042
|
+
return "string";
|
|
1043
|
+
case "boolean":
|
|
1044
|
+
return "boolean";
|
|
1045
|
+
case "array":
|
|
1046
|
+
return wirePropertyTypeV2ToTypeScriptType(property.subType) + "[]";
|
|
1047
|
+
case "integer":
|
|
1048
|
+
return "number";
|
|
1049
|
+
case "attachment":
|
|
1050
|
+
return "Attachment";
|
|
1051
|
+
case "byte":
|
|
1052
|
+
return "number";
|
|
1053
|
+
case "date":
|
|
1054
|
+
return "LocalDate";
|
|
1055
|
+
case "decimal":
|
|
1056
|
+
return "number";
|
|
1057
|
+
case "double":
|
|
1058
|
+
return "number";
|
|
1059
|
+
case "float":
|
|
1060
|
+
return "number";
|
|
1061
|
+
case "geopoint":
|
|
1062
|
+
return "GeoPoint";
|
|
1063
|
+
case "geoshape":
|
|
1064
|
+
return "GeoShape";
|
|
1065
|
+
case "long":
|
|
1066
|
+
return "number";
|
|
1067
|
+
case "short":
|
|
1068
|
+
return "number";
|
|
1069
|
+
case "timestamp":
|
|
1070
|
+
return "Timestamp";
|
|
1071
|
+
case "timeseries":
|
|
1072
|
+
return property.itemType.type === "string" ? `TimeSeries<string>` : `TimeSeries<number>`;
|
|
1073
|
+
default:
|
|
1074
|
+
throw new Error(`Unknown property type ${property}`);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
function getDescriptionIfPresent(description) {
|
|
1078
|
+
if (description) {
|
|
1079
|
+
return `/**
|
|
1080
|
+
* ${description}
|
|
285
1081
|
*/
|
|
286
|
-
|
|
1082
|
+
`;
|
|
1083
|
+
}
|
|
1084
|
+
return "";
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// src/v1.1/generatePerObjectInterfaceAndDataFiles.ts
|
|
1088
|
+
async function generatePerObjectInterfaceAndDataFiles(ontology, fs, outDir, importExt = "") {
|
|
1089
|
+
await fs.mkdir(outDir, {
|
|
1090
|
+
recursive: true
|
|
1091
|
+
});
|
|
1092
|
+
await Promise.all(Object.values(ontology.objectTypes).map(async (object) => {
|
|
1093
|
+
object.linkTypes;
|
|
1094
|
+
await fs.writeFile(path15__namespace.default.join(outDir, `${object.objectType.apiName}.ts`), await formatTs(`
|
|
287
1095
|
import { ObjectTypeDefinition } from "@osdk/api";
|
|
288
|
-
${
|
|
1096
|
+
${wireObjectTypeV2ToObjectInterfaceStringV1(object)}
|
|
289
1097
|
|
|
290
|
-
${
|
|
291
|
-
`));
|
|
292
|
-
|
|
293
|
-
`
|
|
1098
|
+
${wireObjectTypeV2ToSdkObjectConst(object)}
|
|
1099
|
+
`));
|
|
1100
|
+
}));
|
|
1101
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "index.ts"), await formatTs(`
|
|
1102
|
+
${Object.keys(ontology.objectTypes).map((apiName) => `export * from "./${apiName}${importExt}";`).join("\n")}
|
|
294
1103
|
export type { ObjectSet } from "@osdk/legacy-client";
|
|
295
1104
|
|
|
296
|
-
`));
|
|
1105
|
+
`));
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
// src/shared/isNullableQueryDataType.ts
|
|
1109
|
+
function isNullableQueryDataType(input) {
|
|
1110
|
+
if (input.type === "null") {
|
|
1111
|
+
return true;
|
|
1112
|
+
}
|
|
1113
|
+
if (input.type === "union") {
|
|
1114
|
+
return input.unionTypes.some((t) => isNullableQueryDataType(t));
|
|
1115
|
+
}
|
|
1116
|
+
return false;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
// src/shared/wireQueryDataTypeToQueryDataTypeDefinition.ts
|
|
1120
|
+
function wireQueryDataTypeToQueryDataTypeDefinition(input) {
|
|
1121
|
+
switch (input.type) {
|
|
1122
|
+
case "double":
|
|
1123
|
+
case "float":
|
|
1124
|
+
case "integer":
|
|
1125
|
+
case "long":
|
|
1126
|
+
case "attachment":
|
|
1127
|
+
case "boolean":
|
|
1128
|
+
case "date":
|
|
1129
|
+
case "string":
|
|
1130
|
+
case "timestamp":
|
|
1131
|
+
return {
|
|
1132
|
+
type: input.type,
|
|
1133
|
+
nullable: false
|
|
1134
|
+
};
|
|
1135
|
+
case "object":
|
|
1136
|
+
return {
|
|
1137
|
+
type: "object",
|
|
1138
|
+
object: input.objectTypeApiName,
|
|
1139
|
+
nullable: false
|
|
1140
|
+
};
|
|
1141
|
+
case "objectSet":
|
|
1142
|
+
return {
|
|
1143
|
+
type: "objectSet",
|
|
1144
|
+
objectSet: input.objectTypeApiName,
|
|
1145
|
+
nullable: false
|
|
1146
|
+
};
|
|
1147
|
+
case "array":
|
|
1148
|
+
return {
|
|
1149
|
+
...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
|
|
1150
|
+
multiplicity: true
|
|
1151
|
+
};
|
|
1152
|
+
case "set":
|
|
1153
|
+
return {
|
|
1154
|
+
type: "set",
|
|
1155
|
+
set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
|
|
1156
|
+
nullable: false
|
|
1157
|
+
};
|
|
1158
|
+
case "union":
|
|
1159
|
+
const allowNulls = isNullableQueryDataType(input);
|
|
1160
|
+
if (allowNulls && input.unionTypes.length === 2) {
|
|
1161
|
+
const nonnull = input.unionTypes.find((t) => t.type !== null);
|
|
1162
|
+
if (nonnull) {
|
|
1163
|
+
return {
|
|
1164
|
+
...wireQueryDataTypeToQueryDataTypeDefinition(nonnull),
|
|
1165
|
+
nullable: true
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
return {
|
|
1170
|
+
type: "union",
|
|
1171
|
+
union: input.unionTypes.reduce((acc, t) => {
|
|
1172
|
+
if (t.type === "null") {
|
|
1173
|
+
return acc;
|
|
1174
|
+
}
|
|
1175
|
+
acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));
|
|
1176
|
+
return acc;
|
|
1177
|
+
}, []),
|
|
1178
|
+
nullable: allowNulls
|
|
1179
|
+
};
|
|
1180
|
+
case "struct":
|
|
1181
|
+
return {
|
|
1182
|
+
type: "struct",
|
|
1183
|
+
struct: Object.fromEntries(input.fields.map((f) => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)])),
|
|
1184
|
+
nullable: false
|
|
1185
|
+
};
|
|
1186
|
+
case "twoDimensionalAggregation":
|
|
1187
|
+
return {
|
|
1188
|
+
type: "twoDimensionalAggregation",
|
|
1189
|
+
twoDimensionalAggregation: get2DQueryAggregationProps(input)
|
|
1190
|
+
};
|
|
1191
|
+
case "threeDimensionalAggregation":
|
|
1192
|
+
return {
|
|
1193
|
+
type: "threeDimensionalAggregation",
|
|
1194
|
+
threeDimensionalAggregation: get3DQueryAggregationProps(input)
|
|
1195
|
+
};
|
|
1196
|
+
case "null":
|
|
1197
|
+
case "unsupported":
|
|
1198
|
+
throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);
|
|
1199
|
+
default:
|
|
1200
|
+
throw new Error(`Unsupported QueryDataType.type ${input.type}`);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
function get2DQueryAggregationProps(input) {
|
|
1204
|
+
if (input.keyType.type === "range") {
|
|
1205
|
+
return {
|
|
1206
|
+
keyType: input.keyType.type,
|
|
1207
|
+
keySubtype: input.keyType.subType.type,
|
|
1208
|
+
valueType: input.valueType.type
|
|
1209
|
+
};
|
|
1210
|
+
} else {
|
|
1211
|
+
if (guardInvalidKeyTypes(input.keyType)) {
|
|
1212
|
+
return {
|
|
1213
|
+
keyType: input.keyType.type,
|
|
1214
|
+
valueType: input.valueType.type
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
function get3DQueryAggregationProps(input) {
|
|
1221
|
+
if (input.keyType.type === "range") {
|
|
1222
|
+
return {
|
|
1223
|
+
keyType: input.keyType.type,
|
|
1224
|
+
keySubtype: input.keyType.subType.type,
|
|
1225
|
+
valueType: get2DQueryAggregationProps(input.valueType)
|
|
1226
|
+
};
|
|
1227
|
+
} else {
|
|
1228
|
+
if (guardInvalidKeyTypes(input.keyType)) {
|
|
1229
|
+
return {
|
|
1230
|
+
keyType: input.keyType.type,
|
|
1231
|
+
valueType: get2DQueryAggregationProps(input.valueType)
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
function guardInvalidKeyTypes(key) {
|
|
1238
|
+
return key.type === "string" || key.type === "boolean";
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
// src/shared/wireQueryTypeV2ToSdkQueryDefinition.ts
|
|
1242
|
+
function wireQueryTypeV2ToSdkQueryDefinition(input) {
|
|
1243
|
+
return {
|
|
1244
|
+
apiName: input.apiName,
|
|
1245
|
+
description: input.description,
|
|
1246
|
+
displayName: input.displayName,
|
|
1247
|
+
version: input.version,
|
|
1248
|
+
parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),
|
|
1249
|
+
output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1252
|
+
function wireQueryParameterV2ToQueryParameterDefinition(parameter) {
|
|
1253
|
+
return {
|
|
1254
|
+
description: parameter.description,
|
|
1255
|
+
...wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
// src/v1.1/generatePerQueryDataFiles.ts
|
|
1260
|
+
async function generatePerQueryDataFiles(ontology, fs, outDir, importExt = "") {
|
|
1261
|
+
await fs.mkdir(outDir, {
|
|
1262
|
+
recursive: true
|
|
1263
|
+
});
|
|
1264
|
+
await Promise.all(Object.values(ontology.queryTypes).map(async (query) => {
|
|
1265
|
+
const objectTypes = getObjectTypesFromQuery(query);
|
|
1266
|
+
await fs.writeFile(path15__namespace.default.join(outDir, `${query.apiName}.ts`), await formatTs(`
|
|
297
1267
|
import { QueryDefinition } from "@osdk/api";
|
|
298
1268
|
|
|
299
|
-
export const ${
|
|
300
|
-
|
|
301
|
-
`
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
1269
|
+
export const ${query.apiName} = ${JSON.stringify(wireQueryTypeV2ToSdkQueryDefinition(query))} satisfies QueryDefinition<"${query.apiName}", ${objectTypes.length > 0 ? objectTypes.map((apiName) => `"${apiName}"`).join("|") : "never"}>;`));
|
|
1270
|
+
}));
|
|
1271
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "index.ts"), await formatTs(`
|
|
1272
|
+
${Object.values(ontology.queryTypes).map((query) => `export * from "./${query.apiName}${importExt}";`).join("\n")}
|
|
1273
|
+
`));
|
|
1274
|
+
}
|
|
1275
|
+
function getObjectTypesFromQuery(query) {
|
|
1276
|
+
const types = /* @__PURE__ */ new Set();
|
|
1277
|
+
for (const {
|
|
1278
|
+
dataType
|
|
1279
|
+
} of Object.values(query.parameters)) {
|
|
1280
|
+
getObjectTypesFromDataType(dataType, types);
|
|
1281
|
+
}
|
|
1282
|
+
getObjectTypesFromDataType(query.output, types);
|
|
1283
|
+
return Array.from(types);
|
|
1284
|
+
}
|
|
1285
|
+
function getObjectTypesFromDataType(dataType, types) {
|
|
1286
|
+
switch (dataType.type) {
|
|
1287
|
+
case "array":
|
|
1288
|
+
case "set":
|
|
1289
|
+
getObjectTypesFromDataType(dataType.subType, types);
|
|
1290
|
+
return;
|
|
1291
|
+
case "object":
|
|
1292
|
+
types.add(dataType.objectTypeApiName);
|
|
1293
|
+
return;
|
|
1294
|
+
case "objectSet":
|
|
1295
|
+
types.add(dataType.objectTypeApiName);
|
|
1296
|
+
return;
|
|
1297
|
+
case "struct":
|
|
1298
|
+
for (const prop of Object.values(dataType.fields)) {
|
|
1299
|
+
getObjectTypesFromDataType(prop.fieldType, types);
|
|
1300
|
+
}
|
|
1301
|
+
return;
|
|
1302
|
+
case "union":
|
|
1303
|
+
for (const type of dataType.unionTypes) {
|
|
1304
|
+
getObjectTypesFromDataType(type, types);
|
|
1305
|
+
}
|
|
1306
|
+
return;
|
|
1307
|
+
case "attachment":
|
|
1308
|
+
case "boolean":
|
|
1309
|
+
case "date":
|
|
1310
|
+
case "double":
|
|
1311
|
+
case "float":
|
|
1312
|
+
case "integer":
|
|
1313
|
+
case "long":
|
|
1314
|
+
case "null":
|
|
1315
|
+
case "string":
|
|
1316
|
+
case "threeDimensionalAggregation":
|
|
1317
|
+
case "timestamp":
|
|
1318
|
+
case "twoDimensionalAggregation":
|
|
1319
|
+
case "unsupported":
|
|
1320
|
+
return;
|
|
1321
|
+
default:
|
|
1322
|
+
throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
async function generateQueries(ontology, fs, outDir, importExt = "") {
|
|
1326
|
+
const importedObjects = /* @__PURE__ */ new Set();
|
|
1327
|
+
const signatures = [];
|
|
1328
|
+
for (const query of Object.values(ontology.queryTypes)) {
|
|
1329
|
+
const jsDocBlock = ["/**"];
|
|
1330
|
+
if (query.description) {
|
|
1331
|
+
jsDocBlock.push(`* ${query.description}`);
|
|
1332
|
+
}
|
|
1333
|
+
const outputType = handleQueryDataType(query.output, importedObjects, true);
|
|
1334
|
+
const paramEntries = [];
|
|
1335
|
+
for (const [name, parameter] of Object.entries(query.parameters)) {
|
|
1336
|
+
const nullable = isNullableQueryDataType(parameter.dataType);
|
|
1337
|
+
const type = handleQueryDataType(parameter.dataType, importedObjects, false);
|
|
1338
|
+
paramEntries.push(`"${name}"${nullable ? "?" : ""}: ${type}`);
|
|
1339
|
+
jsDocBlock.push(`* @param {${sanitizeDocTypeName(type)}} params.${name}${parameter.description ? ` - ${parameter.description}` : ""}`);
|
|
1340
|
+
}
|
|
1341
|
+
const param = paramEntries.length === 0 ? "" : `params: { ${paramEntries.join("; ")} }`;
|
|
1342
|
+
jsDocBlock.push(`* @returns ${sanitizeDocTypeName(outputType)}`, "*/");
|
|
1343
|
+
signatures.push(`
|
|
1344
|
+
${jsDocBlock.join("\n")}
|
|
1345
|
+
${query.apiName}(${param}): Promise<Result<QueryResponse<${outputType}>, QueryError>>;
|
|
1346
|
+
`);
|
|
1347
|
+
}
|
|
1348
|
+
await fs.mkdir(outDir, {
|
|
1349
|
+
recursive: true
|
|
1350
|
+
});
|
|
1351
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "Queries.ts"), await formatTs(`
|
|
307
1352
|
import type { QueryResponse, QueryError, Result, Timestamp, LocalDate, Range, Attachment, ObjectSet, TwoDimensionalAggregation, ThreeDimensionalAggregation } from "@osdk/legacy-client";
|
|
308
|
-
${Array.from(
|
|
309
|
-
`)}
|
|
1353
|
+
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
310
1354
|
|
|
311
1355
|
export interface Queries {
|
|
312
|
-
${
|
|
313
|
-
`)}
|
|
1356
|
+
${signatures.join("\n")}
|
|
314
1357
|
}
|
|
315
|
-
`));
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
1358
|
+
`));
|
|
1359
|
+
}
|
|
1360
|
+
function handleQueryDataType(dataType, importedObjects, isReturnValue) {
|
|
1361
|
+
switch (dataType.type) {
|
|
1362
|
+
case "boolean":
|
|
1363
|
+
return "boolean";
|
|
1364
|
+
case "string":
|
|
1365
|
+
return "string";
|
|
1366
|
+
case "double":
|
|
1367
|
+
case "float":
|
|
1368
|
+
case "integer":
|
|
1369
|
+
case "long":
|
|
1370
|
+
return "number";
|
|
1371
|
+
case "date":
|
|
1372
|
+
return "LocalDate";
|
|
1373
|
+
case "timestamp":
|
|
1374
|
+
return "Timestamp";
|
|
1375
|
+
case "attachment":
|
|
1376
|
+
return "Attachment";
|
|
1377
|
+
case "array":
|
|
1378
|
+
return `Array<${handleQueryDataType(dataType.subType, importedObjects, isReturnValue)}>`;
|
|
1379
|
+
case "object": {
|
|
1380
|
+
const objectType = dataType.objectTypeApiName;
|
|
1381
|
+
importedObjects.add(objectType);
|
|
1382
|
+
return isReturnValue ? objectType : `${objectType} | ${objectType}["__primaryKey"]`;
|
|
1383
|
+
}
|
|
1384
|
+
case "objectSet": {
|
|
1385
|
+
const objectType = dataType.objectTypeApiName;
|
|
1386
|
+
importedObjects.add(objectType);
|
|
1387
|
+
return `ObjectSet<${objectType}>`;
|
|
1388
|
+
}
|
|
1389
|
+
case "set":
|
|
1390
|
+
return `Set<${handleQueryDataType(dataType.subType, importedObjects, isReturnValue)}>`;
|
|
1391
|
+
case "struct":
|
|
1392
|
+
const properties = dataType.fields.map((field) => {
|
|
1393
|
+
const isNullable = isNullableQueryDataType(field.fieldType);
|
|
1394
|
+
return `${field.name}${isNullable ? "?" : ""}: ${handleQueryDataType(field.fieldType, importedObjects, isReturnValue)}`;
|
|
1395
|
+
});
|
|
1396
|
+
return `{ ${properties.join(",\n")} }`;
|
|
1397
|
+
case "union":
|
|
1398
|
+
return dataType.unionTypes.map((type) => handleQueryDataType(type, importedObjects, isReturnValue)).filter((type) => type !== "null").join("|");
|
|
1399
|
+
case "twoDimensionalAggregation":
|
|
1400
|
+
dataType.valueType;
|
|
1401
|
+
return `TwoDimensionalAggregation<
|
|
1402
|
+
${aggregationKeyToTypescriptType(dataType.keyType)},
|
|
1403
|
+
${aggregationValueToTypescriptType(dataType.valueType)}
|
|
1404
|
+
>`;
|
|
1405
|
+
case "threeDimensionalAggregation":
|
|
1406
|
+
return `ThreeDimensionalAggregation<
|
|
1407
|
+
${aggregationKeyToTypescriptType(dataType.keyType)},
|
|
1408
|
+
${aggregationKeyToTypescriptType(dataType.valueType.keyType)},
|
|
1409
|
+
${aggregationValueToTypescriptType(dataType.valueType.valueType)}
|
|
1410
|
+
>`;
|
|
1411
|
+
case "null":
|
|
1412
|
+
return "null";
|
|
1413
|
+
case "unsupported":
|
|
1414
|
+
throw new Error("Cannot generate queries for unsupported type");
|
|
1415
|
+
default:
|
|
1416
|
+
throw new Error(`Cannot generate queries for type ${dataType.type}`);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
function aggregationKeyToTypescriptType(keyType) {
|
|
1420
|
+
switch (keyType.type) {
|
|
1421
|
+
case "boolean":
|
|
1422
|
+
return "boolean";
|
|
1423
|
+
case "double":
|
|
1424
|
+
case "integer":
|
|
1425
|
+
return "number";
|
|
1426
|
+
case "string":
|
|
1427
|
+
return "string";
|
|
1428
|
+
case "date":
|
|
1429
|
+
return "LocalDate";
|
|
1430
|
+
case "timestamp":
|
|
1431
|
+
return "Timestamp";
|
|
1432
|
+
case "range":
|
|
1433
|
+
return `Range<${aggregationRangeToTypescriptType(keyType.subType)}>`;
|
|
1434
|
+
default:
|
|
1435
|
+
throw new Error(`Unknown TwoDimensionalAggregation keyType ${keyType.type}`);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
function aggregationRangeToTypescriptType(subType) {
|
|
1439
|
+
switch (subType.type) {
|
|
1440
|
+
case "date":
|
|
1441
|
+
return "LocalDate";
|
|
1442
|
+
case "double":
|
|
1443
|
+
case "integer":
|
|
1444
|
+
return "number";
|
|
1445
|
+
case "timestamp":
|
|
1446
|
+
return "Timestamp";
|
|
1447
|
+
default:
|
|
1448
|
+
throw new Error(`Unsupported QueryAggregationRangeSubType ${subType.type}`);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
function aggregationValueToTypescriptType(valueType) {
|
|
1452
|
+
switch (valueType.type) {
|
|
1453
|
+
case "date":
|
|
1454
|
+
return "LocalDate";
|
|
1455
|
+
case "double":
|
|
1456
|
+
return "number";
|
|
1457
|
+
case "timestamp":
|
|
1458
|
+
return "Timestamp";
|
|
1459
|
+
default:
|
|
1460
|
+
throw new Error(`Unsupported QueryAggregationValueType ${valueType.type}`);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
function sanitizeDocTypeName(type) {
|
|
1464
|
+
return type.replace(/\s/g, "");
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
// src/v1.1/generateClientSdkVersionOneDotOne.ts
|
|
1468
|
+
async function generateClientSdkVersionOneDotOne(ontology, fs, outDir, packageType = "commonjs") {
|
|
1469
|
+
const importExt = packageType === "module" ? ".js" : "";
|
|
1470
|
+
const objectsDir = path15__namespace.join(outDir, "ontology", "objects");
|
|
1471
|
+
const actionsDir = path15__namespace.join(outDir, "ontology", "actions");
|
|
1472
|
+
const queriesDir = path15__namespace.join(outDir, "ontology", "queries");
|
|
1473
|
+
await verifyOutdir(outDir, fs);
|
|
1474
|
+
const sanitizedOntology = sanitizeMetadata(ontology);
|
|
1475
|
+
await generateFoundryClientFile(fs, outDir, importExt);
|
|
1476
|
+
await generateMetadataFile(sanitizedOntology, fs, outDir, importExt);
|
|
1477
|
+
await generateOntologyIndexFile(fs, path15__namespace.join(outDir, "ontology"));
|
|
1478
|
+
await generateObjectsInterfaceFile(sanitizedOntology, fs, objectsDir, importExt);
|
|
1479
|
+
await generateObjectsInterfaceSupportFiles(sanitizedOntology, fs, path15__namespace.join(objectsDir, "objects-api"), importExt);
|
|
1480
|
+
await generatePerObjectInterfaceAndDataFiles(sanitizedOntology, fs, objectsDir, importExt);
|
|
1481
|
+
await generateActions(sanitizedOntology, fs, actionsDir, importExt);
|
|
1482
|
+
await generatePerActionDataFiles(sanitizedOntology, fs, actionsDir, importExt);
|
|
1483
|
+
await generateQueries(sanitizedOntology, fs, queriesDir, importExt);
|
|
1484
|
+
await generatePerQueryDataFiles(sanitizedOntology, fs, queriesDir, importExt);
|
|
1485
|
+
await generateIndexFile(fs, outDir, importExt);
|
|
1486
|
+
await generateBackCompatDeprecatedExports(fs, outDir);
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
// src/shared/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.ts
|
|
1490
|
+
function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceType, v2 = false) {
|
|
1491
|
+
return `
|
|
1492
|
+
export const ${interfaceType.apiName} = ${JSON.stringify(wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType), null, 2)} satisfies InterfaceDefinition<"${interfaceType.apiName}", "">;`;
|
|
1493
|
+
}
|
|
1494
|
+
function wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {
|
|
1495
|
+
return {
|
|
1496
|
+
apiName: interfaceType.apiName,
|
|
1497
|
+
description: interfaceType.description,
|
|
1498
|
+
properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {
|
|
1499
|
+
return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];
|
|
1500
|
+
}))
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
async function generateOntologyMetadataFile(ontology, fs, outDir) {
|
|
1504
|
+
fs.writeFile(path15__namespace.default.join(outDir, "OntologyMetadata.ts"), await formatTs(`
|
|
325
1505
|
export const OntologyMetadata = {
|
|
326
|
-
ontologyRid: "${
|
|
327
|
-
ontologyApiName: "${
|
|
1506
|
+
ontologyRid: "${ontology.ontology.rid}",
|
|
1507
|
+
ontologyApiName: "${ontology.ontology.apiName}",
|
|
328
1508
|
userAgent: "foundry-typescript-osdk/2.0.0",
|
|
329
1509
|
}
|
|
330
|
-
`));
|
|
331
|
-
|
|
332
|
-
|
|
1510
|
+
`));
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
// src/v2.0/generateClientSdkVersionTwoPointZero.ts
|
|
1514
|
+
async function generateClientSdkVersionTwoPointZero(ontology, fs, outDir, packageType = "commonjs") {
|
|
1515
|
+
await verifyOutdir(outDir, fs);
|
|
1516
|
+
const sanitizedOntology = sanitizeMetadata(ontology);
|
|
1517
|
+
const objectNames = Object.keys(sanitizedOntology.objectTypes);
|
|
1518
|
+
const actionNames = Object.keys(sanitizedOntology.actionTypes);
|
|
1519
|
+
const interfaceNames = Object.keys(sanitizedOntology.__UNSTABLE_interfaceTypes ?? {});
|
|
1520
|
+
const importExt = packageType === "module" ? ".js" : "";
|
|
1521
|
+
await fs.mkdir(outDir, {
|
|
1522
|
+
recursive: true
|
|
1523
|
+
});
|
|
1524
|
+
fs.writeFile(path15__namespace.default.join(outDir, "index.ts"), await formatTs(`
|
|
1525
|
+
export { Ontology } from "./Ontology${importExt}";
|
|
1526
|
+
`));
|
|
1527
|
+
await generateOntologyMetadataFile(sanitizedOntology, fs, outDir);
|
|
1528
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "Ontology.ts"), await formatTs(`
|
|
333
1529
|
import type { OntologyDefinition } from "@osdk/api";
|
|
334
|
-
import * as Actions from "./ontology/actions/index${
|
|
335
|
-
import * as Objects from "./ontology/objects${
|
|
336
|
-
import * as Interfaces from "./ontology/interfaces${
|
|
337
|
-
import { OntologyMetadata } from "./OntologyMetadata${
|
|
1530
|
+
import * as Actions from "./ontology/actions/index${importExt}";
|
|
1531
|
+
import * as Objects from "./ontology/objects${importExt}";
|
|
1532
|
+
import * as Interfaces from "./ontology/interfaces${importExt}";
|
|
1533
|
+
import { OntologyMetadata } from "./OntologyMetadata${importExt}";
|
|
338
1534
|
|
|
339
1535
|
const _Ontology = {
|
|
340
1536
|
metadata: OntologyMetadata,
|
|
341
1537
|
objects: {
|
|
342
|
-
${
|
|
343
|
-
|
|
1538
|
+
${objectNames.map((objectName) => {
|
|
1539
|
+
return `${objectName}: Objects.${objectName}`;
|
|
1540
|
+
}).join(",\n")}
|
|
344
1541
|
|
|
345
1542
|
},
|
|
346
1543
|
actions: {
|
|
347
|
-
${
|
|
348
|
-
|
|
1544
|
+
${actionNames.map((actionName) => {
|
|
1545
|
+
return `${actionName}: Actions.${actionName}`;
|
|
1546
|
+
}).join(",\n")}
|
|
349
1547
|
},
|
|
350
1548
|
queries: {
|
|
351
1549
|
// TODO
|
|
352
1550
|
},
|
|
353
1551
|
interfaces: {
|
|
354
|
-
${
|
|
355
|
-
|
|
1552
|
+
${interfaceNames.map((objectName) => {
|
|
1553
|
+
return `${objectName}: Interfaces.${objectName}`;
|
|
1554
|
+
}).join(",\n")}
|
|
356
1555
|
|
|
357
1556
|
}
|
|
358
|
-
} satisfies OntologyDefinition<${
|
|
1557
|
+
} satisfies OntologyDefinition<${objectNames.map((n) => `"${n}"`).join("|")}>;
|
|
359
1558
|
|
|
360
1559
|
type _Ontology = typeof _Ontology;
|
|
361
1560
|
export interface Ontology extends _Ontology {}
|
|
362
1561
|
export const Ontology = _Ontology as Ontology;
|
|
363
|
-
`))
|
|
1562
|
+
`));
|
|
1563
|
+
await fs.mkdir(path15__namespace.default.join(outDir, "ontology", "objects"), {
|
|
1564
|
+
recursive: true
|
|
1565
|
+
});
|
|
1566
|
+
for (const name of objectNames) {
|
|
1567
|
+
const obj = ontology.objectTypes[name];
|
|
1568
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "ontology", `objects`, `${name}.ts`), await formatTs(`
|
|
364
1569
|
|
|
365
1570
|
import type { ObjectTypeDefinition } from "@osdk/api";
|
|
366
1571
|
|
|
367
|
-
${
|
|
1572
|
+
${wireObjectTypeV2ToSdkObjectConst(obj, true)}
|
|
368
1573
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
1574
|
+
${/* TODO: FIXME
|
|
1575
|
+
// wireObjectTypeV2ToObjectDefinitionInterfaceString(
|
|
1576
|
+
// obj,
|
|
1577
|
+
// )
|
|
1578
|
+
*/
|
|
1579
|
+
""}
|
|
1580
|
+
`));
|
|
1581
|
+
}
|
|
1582
|
+
await generateOntologyInterfaces(fs, outDir, interfaceNames, ontology, importExt);
|
|
1583
|
+
const actionsDir = path15__namespace.default.join(outDir, "ontology", "actions");
|
|
1584
|
+
await fs.mkdir(actionsDir, {
|
|
1585
|
+
recursive: true
|
|
1586
|
+
});
|
|
1587
|
+
await generatePerActionDataFiles(sanitizedOntology, fs, actionsDir, importExt);
|
|
1588
|
+
await fs.writeFile(path15__namespace.default.join(outDir, "ontology", "objects.ts"), await formatTs(`
|
|
1589
|
+
${Object.keys(ontology.objectTypes).map((apiName) => `export * from "./objects/${apiName}${importExt}";`).join("\n")}
|
|
1590
|
+
`));
|
|
1591
|
+
}
|
|
1592
|
+
async function generateOntologyInterfaces(fs, outDir, interfaceNames, ontology, importExt) {
|
|
1593
|
+
const interfacesDir = path15__namespace.default.join(outDir, "ontology", "interfaces");
|
|
1594
|
+
await fs.mkdir(interfacesDir, {
|
|
1595
|
+
recursive: true
|
|
1596
|
+
});
|
|
1597
|
+
for (const name of interfaceNames) {
|
|
1598
|
+
const obj = ontology.__UNSTABLE_interfaceTypes[name];
|
|
1599
|
+
await fs.writeFile(path15__namespace.default.join(interfacesDir, `${name}.ts`), await formatTs(`
|
|
374
1600
|
|
|
375
1601
|
import type { InterfaceDefinition } from "@osdk/api";
|
|
376
1602
|
|
|
377
|
-
${
|
|
378
|
-
`));
|
|
379
|
-
|
|
380
|
-
`
|
|
381
|
-
`))
|
|
1603
|
+
${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, true)}
|
|
1604
|
+
`));
|
|
1605
|
+
}
|
|
1606
|
+
await fs.writeFile(interfacesDir + ".ts", await formatTs(`
|
|
1607
|
+
${Object.keys(ontology.__UNSTABLE_interfaceTypes ?? {}).map((apiName) => `export * from "./interfaces/${apiName}${importExt}";`).join("\n")}
|
|
1608
|
+
`));
|
|
1609
|
+
}
|
|
382
1610
|
|
|
383
|
-
exports.generateClientSdkVersionOneDotOne =
|
|
384
|
-
exports.generateClientSdkVersionTwoPointZero =
|
|
1611
|
+
exports.generateClientSdkVersionOneDotOne = generateClientSdkVersionOneDotOne;
|
|
1612
|
+
exports.generateClientSdkVersionTwoPointZero = generateClientSdkVersionTwoPointZero;
|
|
385
1613
|
//# sourceMappingURL=out.js.map
|
|
386
1614
|
//# sourceMappingURL=index.cjs.map
|