@player-tools/xlr-sdk 0.13.0-next.3 → 0.13.0-next.5
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/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.legacy-esm.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/__snapshots__/sdk.test.ts.snap +1342 -66
- package/src/__tests__/sdk.test.ts +19 -2
- package/src/sdk.ts +1 -1
- package/src/__tests__/utils.test.ts +0 -0
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { test, expect, describe } from "vitest";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
NamedType,
|
|
4
|
+
TransformFunction,
|
|
5
|
+
OrType,
|
|
6
|
+
ObjectType,
|
|
7
|
+
} from "@player-tools/xlr";
|
|
3
8
|
import { parseTree } from "jsonc-parser";
|
|
4
9
|
import {
|
|
5
10
|
Types,
|
|
@@ -70,9 +75,21 @@ describe("Object Recall", () => {
|
|
|
70
75
|
const sdk = new XLRSDK();
|
|
71
76
|
sdk.loadDefinitionsFromModule(Types);
|
|
72
77
|
sdk.loadDefinitionsFromModule(ReferenceAssetsWebPluginManifest);
|
|
73
|
-
|
|
74
78
|
expect(sdk.getType("InputAsset")).toMatchSnapshot();
|
|
75
79
|
});
|
|
80
|
+
|
|
81
|
+
test("Test Correct Generic Cascading", () => {
|
|
82
|
+
const sdk = new XLRSDK();
|
|
83
|
+
sdk.loadDefinitionsFromModule(Types);
|
|
84
|
+
sdk.loadDefinitionsFromModule(ReferenceAssetsWebPluginManifest);
|
|
85
|
+
const Flow = sdk.getType("Flow") as ObjectType;
|
|
86
|
+
const Schema = Flow.properties["schema"].node as ObjectType;
|
|
87
|
+
const Node = Schema.additionalProperties as ObjectType;
|
|
88
|
+
const DataTypes = Node.additionalProperties as OrType;
|
|
89
|
+
const DataType = DataTypes.or[0] as ObjectType;
|
|
90
|
+
const df = DataType.properties["default"].node;
|
|
91
|
+
expect(df.type).toBe("unknown");
|
|
92
|
+
});
|
|
76
93
|
});
|
|
77
94
|
|
|
78
95
|
describe("Validation", () => {
|
package/src/sdk.ts
CHANGED
|
@@ -311,7 +311,7 @@ export class XLRSDK {
|
|
|
311
311
|
* - filing in any remaining generics with their default value
|
|
312
312
|
*/
|
|
313
313
|
private resolveType(type: NamedType, optimize = true): NamedType {
|
|
314
|
-
const resolvedObject = fillInGenerics(type);
|
|
314
|
+
const resolvedObject = fillInGenerics(type, new Map(), true);
|
|
315
315
|
|
|
316
316
|
let transformMap: TransformFunctionMap = {
|
|
317
317
|
object: [(objectNode: ObjectType) => {
|
|
File without changes
|