diff --git a/typescript/packages/model.usage/babel.config.cjs b/typescript/packages/model.usage/babel.config.cjs new file mode 100644 index 0000000..392abb6 --- /dev/null +++ b/typescript/packages/model.usage/babel.config.cjs @@ -0,0 +1,12 @@ +module.exports = { + presets: [ + [ + "@babel/preset-env", + { + targets: { + node: "current", + }, + }, + ], + ], +}; diff --git a/typescript/packages/model.usage/package.json b/typescript/packages/model.usage/package.json index 1946982..ce46a0d 100644 --- a/typescript/packages/model.usage/package.json +++ b/typescript/packages/model.usage/package.json @@ -10,16 +10,22 @@ "type-graphql": "^1.1.1" }, "devDependencies": { + "@babel/preset-env": "^7.16.11", "@types/jest": "^27.4.1", "command-line-args": "^5.2.1", "command-line-usage": "^6.1.1", - "jest": "^27.5.1", + "jest": "^28.0.0-alpha.3", "ts-jest": "^27.1.3", "typescript": "^4.6.2" }, "scripts": { "build": "tsc", - "watch": "tsc -w" + "watch": "tsc -w", + "test": "node ./node_modules/jest/bin/jest.js" }, - "test": "node ./node_modules/jest/bin/jest.js" + "jest": { + "testMatch": [ + "**/__tests__/**/*.test.js" + ] + } } diff --git a/typescript/packages/model.usage/src/example/generated/__tests__/SlideQuery.test.ts b/typescript/packages/model.usage/src/example/generated/__tests__/SlideQuery.test.ts index 0a853b6..cd3d5d0 100644 --- a/typescript/packages/model.usage/src/example/generated/__tests__/SlideQuery.test.ts +++ b/typescript/packages/model.usage/src/example/generated/__tests__/SlideQuery.test.ts @@ -1 +1,7 @@ +import sid from "@strut/sid"; +import SlideQuery from "../SlideQuery.js"; + // We'll try to load all slides and see how it goes! +test("Query from id", () => { + SlideQuery.fromId(sid("foo")); +}); diff --git a/typescript/packages/model/README.md b/typescript/packages/model/README.md index 411867c..4367d40 100644 --- a/typescript/packages/model/README.md +++ b/typescript/packages/model/README.md @@ -1,10 +1,10 @@ TODO: -1. Put field edge ids into `Data` -2. Generate call `fromForiegnKey` (fromSlideId) in methods like `queryComponents` on `Slide` -3. Use ID types... -4. Validation step... +1. Validation step... 1. To ensure foreign key edges have an appropriate inverse field edge 1. on the other schema. +2. Generate MySQL Table Schemas +3. Generate queryAll methods +4. Enable model interfaces Are the synthetic transactions not good enough / not doing it? diff --git a/typescript/packages/model/src/query/Query.ts b/typescript/packages/model/src/query/Query.ts index feeb3be..172e878 100644 --- a/typescript/packages/model/src/query/Query.ts +++ b/typescript/packages/model/src/query/Query.ts @@ -69,7 +69,7 @@ export abstract class DerivedQuery extends BaseQuery { #priorQuery: Query; #expression?: Expression; - constructor(priorQuery: Query, expression?: Expression) { + constructor(priorQuery: Query, expression?: Expression) { super(); this.#priorQuery = priorQuery; this.#expression = expression;