@osdk/foundry-sdk-generator 2.0.2-rc.3 → 2.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 +18 -0
- package/build/browser/index.js +207 -32
- package/build/browser/index.js.map +1 -1
- package/build/esm/generate/GeneratePackageCommand.d.ts +1 -0
- package/build/esm/generate/GeneratePackageCommand.d.ts.map +1 -1
- package/build/esm/generate/betaClient/generatePackage.d.ts +2 -2
- package/build/esm/generate/betaClient/generatePackage.d.ts.map +1 -1
- package/build/esm/index.js +207 -32
- package/build/esm/index.js.map +1 -1
- package/build/esm/ontologyMetadata/ontologyMetadataResolver.d.ts +16 -3
- package/build/esm/ontologyMetadata/ontologyMetadataResolver.d.ts.map +1 -1
- package/package.json +11 -6
package/build/esm/index.js
CHANGED
|
@@ -20,6 +20,99 @@ var getFilename = () => fileURLToPath(import.meta.url);
|
|
|
20
20
|
var getDirname = () => path2__default.dirname(getFilename());
|
|
21
21
|
var __dirname = /* @__PURE__ */ getDirname();
|
|
22
22
|
|
|
23
|
+
// ../../node_modules/.pnpm/conjure-lite@0.4.4/node_modules/conjure-lite/dist/index.mjs
|
|
24
|
+
async function conjureFetch({
|
|
25
|
+
fetchFn,
|
|
26
|
+
baseUrl,
|
|
27
|
+
servicePath,
|
|
28
|
+
tokenProvider
|
|
29
|
+
}, url, method, body, params, contentType, accept) {
|
|
30
|
+
const queryParams = Object.entries({}).flatMap(([key, value]) => {
|
|
31
|
+
if (value == null) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
return value.map((item) => [key, item]);
|
|
36
|
+
}
|
|
37
|
+
const stringValue = "" + value;
|
|
38
|
+
return stringValue.length === 0 ? [] : [[key, stringValue]];
|
|
39
|
+
});
|
|
40
|
+
const query = Object.keys(queryParams).length === 0 ? "" : `?${new URLSearchParams(queryParams).toString()}`;
|
|
41
|
+
const response = await (fetchFn ?? fetch)(`${baseUrl}${servicePath}${url}${query}`, {
|
|
42
|
+
method,
|
|
43
|
+
credentials: "same-origin",
|
|
44
|
+
headers: {
|
|
45
|
+
"Fetch-User-Agent": "conjure-lite",
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
accept: "application/json",
|
|
48
|
+
...tokenProvider ? {
|
|
49
|
+
"Authorization": `Bearer ${await tokenProvider()}`
|
|
50
|
+
} : {}
|
|
51
|
+
},
|
|
52
|
+
...{}
|
|
53
|
+
});
|
|
54
|
+
try {
|
|
55
|
+
if (response.status === 204) {
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
58
|
+
const body2 = await readBody(response);
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
throw new ConjureError("STATUS", void 0, response.status, body2);
|
|
61
|
+
}
|
|
62
|
+
return body2;
|
|
63
|
+
} catch (error) {
|
|
64
|
+
if (error instanceof ConjureError) {
|
|
65
|
+
throw error;
|
|
66
|
+
} else if (error instanceof TypeError) {
|
|
67
|
+
throw new ConjureError("NETWORK", error);
|
|
68
|
+
} else {
|
|
69
|
+
throw new ConjureError("OTHER", error);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async function readBody(response) {
|
|
74
|
+
const contentType = response.headers.get("Content-Type") != null ? response.headers.get("Content-Type") : "";
|
|
75
|
+
try {
|
|
76
|
+
if (contentType.includes("application/json")) {
|
|
77
|
+
return await response.json();
|
|
78
|
+
} else if (contentType.includes("application/octet-stream")) {
|
|
79
|
+
return await response.blob();
|
|
80
|
+
} else {
|
|
81
|
+
return await response.text();
|
|
82
|
+
}
|
|
83
|
+
} catch (error) {
|
|
84
|
+
throw new ConjureError("PARSE", error, response.status);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
var ConjureError = class {
|
|
88
|
+
type;
|
|
89
|
+
originalError;
|
|
90
|
+
status;
|
|
91
|
+
body;
|
|
92
|
+
constructor(errorType, originalError, status, body) {
|
|
93
|
+
this.type = errorType;
|
|
94
|
+
this.originalError = originalError;
|
|
95
|
+
this.status = status;
|
|
96
|
+
this.body = body;
|
|
97
|
+
}
|
|
98
|
+
toString() {
|
|
99
|
+
return JSON.stringify({
|
|
100
|
+
body: this.body,
|
|
101
|
+
originalError: this.originalError && this.originalError.toString(),
|
|
102
|
+
status: this.status,
|
|
103
|
+
type: this.type
|
|
104
|
+
}, null, " ");
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// ../client.unstable.tpsa/build/esm/index.js
|
|
109
|
+
async function getSdk(ctx, repositoryRid, packageName, sdkVersion) {
|
|
110
|
+
return conjureFetch(ctx, `/sdks/${repositoryRid}/${packageName}/${sdkVersion}`, "GET");
|
|
111
|
+
}
|
|
112
|
+
async function getSdkPackage(ctx, sdkPackageRid) {
|
|
113
|
+
return conjureFetch(ctx, `/sdks/packages/${sdkPackageRid}`, "GET");
|
|
114
|
+
}
|
|
115
|
+
|
|
23
116
|
// src/ontologyMetadata/Result.ts
|
|
24
117
|
var Ok = class {
|
|
25
118
|
constructor(value) {
|
|
@@ -101,24 +194,41 @@ var OntologyMetadataResolver = class {
|
|
|
101
194
|
getClientContext() {
|
|
102
195
|
return createClientContext(this.stackName.match(/^https?:\/\//) ? this.stackName : `https://${this.stackName}`, () => this.#authToken, `foundry-typescript-osdk-generator/${process.env.npm_package_version}`);
|
|
103
196
|
}
|
|
104
|
-
|
|
105
|
-
const filteredObjectTypes = Object.fromEntries(Object.entries(ontologyFullMetadata.objectTypes).filter(([
|
|
106
|
-
|
|
197
|
+
filterMetadataByApiName(ontologyFullMetadata, expectedEntities, pkgInfo) {
|
|
198
|
+
const filteredObjectTypes = Object.fromEntries(Object.entries(ontologyFullMetadata.objectTypes).filter(([, {
|
|
199
|
+
objectType
|
|
200
|
+
}]) => {
|
|
201
|
+
for (const {
|
|
202
|
+
sdk: {
|
|
203
|
+
inputs: {
|
|
204
|
+
dataScope
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
} of pkgInfo.values()) {
|
|
208
|
+
for (const objectTypeRid of dataScope.ontologyV2.objectTypes) {
|
|
209
|
+
if (objectTypeRid === objectType.rid) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return expectedEntities.objectTypes.has(objectType.apiName);
|
|
215
|
+
}));
|
|
216
|
+
const filteredInterfaceTypes = Object.fromEntries(Object.entries(ontologyFullMetadata.interfaceTypes).filter(([interfaceApiName]) => expectedEntities.interfaceTypes.has(interfaceApiName)));
|
|
107
217
|
Object.values(filteredObjectTypes).forEach((objectType) => {
|
|
108
|
-
const linkTypesToKeep = expectedEntities.linkTypes.get(objectType.objectType.apiName
|
|
218
|
+
const linkTypesToKeep = expectedEntities.linkTypes.get(objectType.objectType.apiName);
|
|
109
219
|
if (!linkTypesToKeep) {
|
|
110
220
|
objectType.linkTypes = [];
|
|
111
221
|
return;
|
|
112
222
|
}
|
|
113
|
-
objectType.linkTypes = objectType.linkTypes.filter((linkType) => linkTypesToKeep.has(linkType.apiName
|
|
223
|
+
objectType.linkTypes = objectType.linkTypes.filter((linkType) => linkTypesToKeep.has(linkType.apiName));
|
|
114
224
|
});
|
|
115
225
|
const filteredActionTypes = Object.fromEntries(Object.entries(ontologyFullMetadata.actionTypes).filter(([actionApiName]) => {
|
|
116
|
-
if (expectedEntities.actionTypes.has(this.camelize(actionApiName)
|
|
226
|
+
if (expectedEntities.actionTypes.has(this.camelize(actionApiName))) {
|
|
117
227
|
return true;
|
|
118
228
|
}
|
|
119
229
|
return false;
|
|
120
230
|
}));
|
|
121
|
-
const filteredQueryTypes = Object.fromEntries(Object.entries(ontologyFullMetadata.queryTypes).filter(([queryApiName]) => expectedEntities.queryTypes.has(queryApiName
|
|
231
|
+
const filteredQueryTypes = Object.fromEntries(Object.entries(ontologyFullMetadata.queryTypes).filter(([queryApiName]) => expectedEntities.queryTypes.has(queryApiName)));
|
|
122
232
|
return {
|
|
123
233
|
ontology: ontologyFullMetadata.ontology,
|
|
124
234
|
objectTypes: filteredObjectTypes,
|
|
@@ -128,7 +238,25 @@ var OntologyMetadataResolver = class {
|
|
|
128
238
|
sharedPropertyTypes: {}
|
|
129
239
|
};
|
|
130
240
|
}
|
|
131
|
-
async
|
|
241
|
+
async getInfoForPackages(pkgs) {
|
|
242
|
+
const conjureCtx = {
|
|
243
|
+
baseUrl: `https://${this.stackName}`,
|
|
244
|
+
servicePath: "/third-party-application-service/api",
|
|
245
|
+
tokenProvider: () => Promise.resolve(this.#authToken)
|
|
246
|
+
};
|
|
247
|
+
const ret = /* @__PURE__ */ new Map();
|
|
248
|
+
for (const [packageRid, packageVersion] of pkgs) {
|
|
249
|
+
const sdkPackage = await getSdkPackage(conjureCtx, packageRid);
|
|
250
|
+
const sdk = await getSdk(conjureCtx, sdkPackage.repositoryRid, sdkPackage.packageName, packageVersion);
|
|
251
|
+
ret.set(packageRid, {
|
|
252
|
+
sdkPackage,
|
|
253
|
+
sdk,
|
|
254
|
+
packageVersion
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
return ret;
|
|
258
|
+
}
|
|
259
|
+
async getWireOntologyDefinition(ontologyRid, entities, extPackageInfo = /* @__PURE__ */ new Map()) {
|
|
132
260
|
let ontology;
|
|
133
261
|
const {
|
|
134
262
|
Ontologies
|
|
@@ -146,40 +274,68 @@ var OntologyMetadataResolver = class {
|
|
|
146
274
|
return Result.err([`Unable to load the specified Ontology metadata.
|
|
147
275
|
${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
148
276
|
}
|
|
277
|
+
const externalObjects = /* @__PURE__ */ new Map();
|
|
278
|
+
const externalInterfaces = /* @__PURE__ */ new Map();
|
|
279
|
+
for (const {
|
|
280
|
+
sdk
|
|
281
|
+
} of extPackageInfo.values()) {
|
|
282
|
+
if (sdk.npm?.npmPackageName == null) {
|
|
283
|
+
throw new Error("External package is not generated as an npm package");
|
|
284
|
+
}
|
|
285
|
+
const dataScope = sdk.inputs.dataScope.ontologyV2;
|
|
286
|
+
for (const rid of dataScope.objectTypes) {
|
|
287
|
+
const ot = Object.values(ontologyFullMetadata.objectTypes).find((ot2) => ot2.objectType.rid === rid);
|
|
288
|
+
if (!ot) {
|
|
289
|
+
throw new Error(`Could not find external object type with rid ${rid}`);
|
|
290
|
+
}
|
|
291
|
+
externalObjects.set(ot.objectType.apiName, sdk.npm.npmPackageName);
|
|
292
|
+
}
|
|
293
|
+
for (const rid of dataScope.interfaceTypes) {
|
|
294
|
+
const it = Object.values(ontologyFullMetadata.interfaceTypes).find((it2) => it2.rid === rid);
|
|
295
|
+
if (!it) {
|
|
296
|
+
throw new Error(`Could not find external interface type with rid ${rid}`);
|
|
297
|
+
}
|
|
298
|
+
externalInterfaces.set(it.apiName, sdk.npm.npmPackageName);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
149
301
|
const linkTypes = /* @__PURE__ */ new Map();
|
|
150
|
-
const objectTypes = new Set(entities.objectTypesApiNamesToLoad
|
|
151
|
-
const queryTypes = new Set(entities.queryTypesApiNamesToLoad
|
|
152
|
-
const actionTypes = new Set(entities.actionTypesApiNamesToLoad?.map((action) => this.camelize(action)
|
|
153
|
-
const interfaceTypes = new Set(entities.interfaceTypesApiNamesToLoad
|
|
302
|
+
const objectTypes = new Set(entities.objectTypesApiNamesToLoad);
|
|
303
|
+
const queryTypes = new Set(entities.queryTypesApiNamesToLoad);
|
|
304
|
+
const actionTypes = new Set(entities.actionTypesApiNamesToLoad?.map((action) => this.camelize(action)));
|
|
305
|
+
const interfaceTypes = new Set(entities.interfaceTypesApiNamesToLoad);
|
|
154
306
|
for (const linkType of entities.linkTypesApiNamesToLoad ?? []) {
|
|
155
|
-
const [objectTypeApiName, linkTypeApiName] = linkType.
|
|
307
|
+
const [objectTypeApiName, linkTypeApiName] = linkType.split(".");
|
|
156
308
|
if (!linkTypes.has(objectTypeApiName)) {
|
|
157
309
|
linkTypes.set(objectTypeApiName, /* @__PURE__ */ new Set());
|
|
158
310
|
}
|
|
159
311
|
linkTypes.get(objectTypeApiName)?.add(linkTypeApiName);
|
|
160
312
|
}
|
|
161
|
-
const filteredFullMetadata = this.
|
|
313
|
+
const filteredFullMetadata = this.filterMetadataByApiName(ontologyFullMetadata, {
|
|
162
314
|
objectTypes,
|
|
163
315
|
linkTypes,
|
|
164
316
|
actionTypes,
|
|
165
317
|
queryTypes,
|
|
166
318
|
interfaceTypes
|
|
167
|
-
});
|
|
319
|
+
}, extPackageInfo);
|
|
168
320
|
const validData = this.validateLoadedOntologyMetadata(filteredFullMetadata, {
|
|
169
321
|
objectTypes,
|
|
170
322
|
linkTypes,
|
|
171
323
|
actionTypes,
|
|
172
324
|
queryTypes
|
|
173
|
-
});
|
|
325
|
+
}, ontologyFullMetadata, extPackageInfo);
|
|
174
326
|
if (validData.isErr()) {
|
|
175
327
|
return Result.err(validData.error);
|
|
176
328
|
}
|
|
177
|
-
return Result.ok(
|
|
329
|
+
return Result.ok({
|
|
330
|
+
filteredFullMetadata,
|
|
331
|
+
externalInterfaces,
|
|
332
|
+
externalObjects
|
|
333
|
+
});
|
|
178
334
|
}
|
|
179
|
-
validateLoadedOntologyMetadata(filteredFullMetadata, expectedEntities) {
|
|
335
|
+
validateLoadedOntologyMetadata(filteredFullMetadata, expectedEntities, fullOntology, packageInfo) {
|
|
180
336
|
const errors = [];
|
|
181
|
-
const loadedObjectTypes = Object.fromEntries(Object.values(filteredFullMetadata.objectTypes).map((object) => [object.objectType.apiName
|
|
182
|
-
const loadedLinkTypes = Object.fromEntries(Object.values(filteredFullMetadata.objectTypes).map((object) => [object.objectType.apiName
|
|
337
|
+
const loadedObjectTypes = Object.fromEntries(Object.values(filteredFullMetadata.objectTypes).map((object) => [object.objectType.apiName, object]));
|
|
338
|
+
const loadedLinkTypes = Object.fromEntries(Object.values(filteredFullMetadata.objectTypes).map((object) => [object.objectType.apiName, Object.fromEntries(object.linkTypes.map((link) => [link.apiName, link]))]));
|
|
183
339
|
const missingObjectTypes = [];
|
|
184
340
|
for (const object of expectedEntities.objectTypes) {
|
|
185
341
|
if (!loadedObjectTypes[object]) {
|
|
@@ -192,15 +348,19 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
192
348
|
}
|
|
193
349
|
}
|
|
194
350
|
for (const [, link] of Object.entries(loadedLinkTypes[object])) {
|
|
195
|
-
if (!expectedEntities.objectTypes.has(link.objectTypeApiName
|
|
351
|
+
if (!expectedEntities.objectTypes.has(link.objectTypeApiName)) {
|
|
352
|
+
const fromFull = fullOntology.objectTypes[link.objectTypeApiName];
|
|
353
|
+
if (fromFull && hasObjectType(packageInfo, fromFull)) {
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
196
356
|
errors.push(`Unable to load link type ${link.apiName} for ${loadedObjectTypes[object].objectType.apiName}, because the target object type ${link.objectTypeApiName} is not loaded. Please specify the target Object type with --objectTypes ${link.objectTypeApiName}`);
|
|
197
357
|
}
|
|
198
358
|
}
|
|
199
359
|
}
|
|
200
360
|
if (missingObjectTypes.length > 0) {
|
|
201
|
-
errors.push(`Unable to find the following Object Types: ${missingObjectTypes.join()}`);
|
|
361
|
+
errors.push(`Unable to find the following Object Types: ${missingObjectTypes.join(", ")}`);
|
|
202
362
|
}
|
|
203
|
-
const loadedQueryTypes = Object.fromEntries(Object.entries(filteredFullMetadata.queryTypes).map(([queryApiName, query]) => [queryApiName
|
|
363
|
+
const loadedQueryTypes = Object.fromEntries(Object.entries(filteredFullMetadata.queryTypes).map(([queryApiName, query]) => [queryApiName, query]));
|
|
204
364
|
const missingQueryTypes = [];
|
|
205
365
|
for (const queryApiName of expectedEntities.queryTypes) {
|
|
206
366
|
if (!loadedQueryTypes[queryApiName]) {
|
|
@@ -218,7 +378,7 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
218
378
|
if (missingQueryTypes.length > 0) {
|
|
219
379
|
errors.push(`Unable to find the following Query Types: ${missingQueryTypes.join()}`);
|
|
220
380
|
}
|
|
221
|
-
const loadedActionTypes = Object.fromEntries(Object.entries(filteredFullMetadata.actionTypes).map(([actionApiName, action]) => [this.camelize(actionApiName)
|
|
381
|
+
const loadedActionTypes = Object.fromEntries(Object.entries(filteredFullMetadata.actionTypes).map(([actionApiName, action]) => [this.camelize(actionApiName), action]));
|
|
222
382
|
const missingActionTypes = [];
|
|
223
383
|
for (const actionApiName of expectedEntities.actionTypes) {
|
|
224
384
|
if (!loadedActionTypes[actionApiName]) {
|
|
@@ -259,7 +419,7 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
259
419
|
return this.visitSupportedQueryTypes(queryApiName, propertyName, baseType.subType, loadedObjectApiNames);
|
|
260
420
|
case "objectSet":
|
|
261
421
|
case "object":
|
|
262
|
-
if (loadedObjectApiNames.has(baseType.objectTypeApiName
|
|
422
|
+
if (loadedObjectApiNames.has(baseType.objectTypeApiName)) {
|
|
263
423
|
return Result.ok({});
|
|
264
424
|
}
|
|
265
425
|
return Result.err([`Unable to load query ${queryApiName} because it takes an unloaded object type as a parameter: ${baseType.objectTypeApiName} in parameter ${propertyName}. Make sure to specify it as an argument with --ontologyObjects ${baseType.objectTypeApiName}.}`]);
|
|
@@ -299,12 +459,12 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
299
459
|
case "array":
|
|
300
460
|
return this.isSupportedActionTypeParameter(actionApiName, actonTypeParameter.subType, loadedObjectApiNames);
|
|
301
461
|
case "object":
|
|
302
|
-
if (loadedObjectApiNames.has(actonTypeParameter.objectTypeApiName
|
|
462
|
+
if (loadedObjectApiNames.has(actonTypeParameter.objectTypeApiName)) {
|
|
303
463
|
return Result.ok({});
|
|
304
464
|
}
|
|
305
465
|
return Result.err([`Unable to load action ${actionApiName} because it takes an unloaded object type as a parameter: ${actonTypeParameter.objectTypeApiName} make sure to specify it as an argument with --ontologyObjects ${actonTypeParameter.objectTypeApiName})`]);
|
|
306
466
|
case "objectSet":
|
|
307
|
-
if (loadedObjectApiNames.has(actonTypeParameter.objectTypeApiName
|
|
467
|
+
if (loadedObjectApiNames.has(actonTypeParameter.objectTypeApiName)) {
|
|
308
468
|
return Result.ok({});
|
|
309
469
|
}
|
|
310
470
|
return Result.err([`Unable to load action ${actionApiName} because it takes an ObjectSet of unloaded object type as a parameter: ${actonTypeParameter.objectTypeApiName} make sure to specify it as an argument with --ontologyObjects ${actonTypeParameter.objectTypeApiName})`]);
|
|
@@ -325,6 +485,17 @@ ${JSON.stringify(ontologyFullMetadata, null, 2)}`]);
|
|
|
325
485
|
return name.replace(/-./g, (segment) => segment[1].toUpperCase());
|
|
326
486
|
}
|
|
327
487
|
};
|
|
488
|
+
function hasObjectType(z, fromFull) {
|
|
489
|
+
for (const q of z.values()) {
|
|
490
|
+
const {
|
|
491
|
+
objectTypes
|
|
492
|
+
} = q.sdk.inputs.dataScope.ontologyV2;
|
|
493
|
+
if (objectTypes.includes(fromFull.objectType.rid)) {
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
328
499
|
|
|
329
500
|
// src/utils/semverUtils.ts
|
|
330
501
|
var semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
@@ -333,7 +504,7 @@ function isValidSemver(semverString) {
|
|
|
333
504
|
}
|
|
334
505
|
|
|
335
506
|
// src/utils/UserAgent.ts
|
|
336
|
-
var USER_AGENT = `typescript-sdk-generator/${"2.0.2
|
|
507
|
+
var USER_AGENT = `typescript-sdk-generator/${"2.0.2"}`;
|
|
337
508
|
async function createRollupBuild(absolutePackagePath, packageName) {
|
|
338
509
|
const inputPath = `${absolutePackagePath}/${packageName}/index.js`;
|
|
339
510
|
const {
|
|
@@ -626,7 +797,7 @@ var betaDependencies = {
|
|
|
626
797
|
var betaPeerDependencies = {
|
|
627
798
|
"@osdk/client": typeof __OSDK_CLIENT_VERSION__ !== "undefined" ? __OSDK_CLIENT_VERSION__ : void 0
|
|
628
799
|
};
|
|
629
|
-
async function generatePackage(
|
|
800
|
+
async function generatePackage(ontologyInfo, options) {
|
|
630
801
|
const {
|
|
631
802
|
consola
|
|
632
803
|
} = await import('consola');
|
|
@@ -651,7 +822,7 @@ async function generatePackage(ontology, options) {
|
|
|
651
822
|
if (!options.beta) {
|
|
652
823
|
throw new Error("Only beta is supported in this version");
|
|
653
824
|
} else {
|
|
654
|
-
await generateClientSdkVersionTwoPointZero(
|
|
825
|
+
await generateClientSdkVersionTwoPointZero(ontologyInfo.filteredFullMetadata, `typescript-sdk/${options.packageVersion} ${USER_AGENT}`, hostFs, packagePath, "module", ontologyInfo.externalObjects, ontologyInfo.externalInterfaces);
|
|
655
826
|
}
|
|
656
827
|
const compilerOutput = compileInMemory(inMemoryFileSystem, {
|
|
657
828
|
esm: options.beta
|
|
@@ -814,7 +985,10 @@ var GeneratePackageCommand = class {
|
|
|
814
985
|
array: true,
|
|
815
986
|
string: true,
|
|
816
987
|
// experimental for now
|
|
817
|
-
hidden: true
|
|
988
|
+
hidden: true,
|
|
989
|
+
coerce: (arg) => {
|
|
990
|
+
return new Map(arg.map((sdkPackage) => sdkPackage.split("=", 2)));
|
|
991
|
+
}
|
|
818
992
|
}).strict();
|
|
819
993
|
}
|
|
820
994
|
handler = async (args) => {
|
|
@@ -828,6 +1002,7 @@ var GeneratePackageCommand = class {
|
|
|
828
1002
|
consola.error(new Error(`Invalid argument provided for packageVersion: ${args.packageVersion}, expected valid semver`));
|
|
829
1003
|
exit(1);
|
|
830
1004
|
}
|
|
1005
|
+
const packageInfo = await ontologyMetadataResolver.getInfoForPackages(args.sdkPackages ?? /* @__PURE__ */ new Map());
|
|
831
1006
|
const timeStart = Date.now();
|
|
832
1007
|
const wireOntologyDefinition = await ontologyMetadataResolver.getWireOntologyDefinition(ontologyRid, {
|
|
833
1008
|
objectTypesApiNamesToLoad: transformArrayArg(args.objectTypes),
|
|
@@ -835,7 +1010,7 @@ var GeneratePackageCommand = class {
|
|
|
835
1010
|
queryTypesApiNamesToLoad: transformArrayArg(args.queryTypes),
|
|
836
1011
|
interfaceTypesApiNamesToLoad: transformArrayArg(args.interfaceTypes),
|
|
837
1012
|
linkTypesApiNamesToLoad: transformArrayArg(args.linkTypes)
|
|
838
|
-
});
|
|
1013
|
+
}, packageInfo);
|
|
839
1014
|
if (wireOntologyDefinition.isErr()) {
|
|
840
1015
|
wireOntologyDefinition.error.forEach((err) => {
|
|
841
1016
|
consola.error(err);
|