Loading .github/workflows/build.yaml +9 −9 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - run: deno task test --coverage=.cov --junit-path=.test-report.xml env: RUST_BACKTRACE: ${{ runner.debug }} Loading Loading @@ -124,7 +124,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading Loading @@ -181,7 +181,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading @@ -207,7 +207,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading @@ -230,7 +230,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - run: deno task hooks:pre-commit release-test: Loading @@ -248,7 +248,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading Loading @@ -283,7 +283,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading Loading @@ -449,7 +449,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - run: deno task codegen working-directory: ${{ github.workspace }}/fedify/ - uses: denoland/deployctl@v1 Loading Loading @@ -480,7 +480,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading fedify/codegen/codec.ts +7 −3 Original line number Diff line number Diff line import metadata from "../deno.json" with { type: "json" }; import { generateField, getFieldName } from "./field.ts"; import { isNonFunctionalProperty } from "./schema.ts"; import type { TypeSchema } from "./schema.ts"; import { areAllScalarTypes, Loading Loading @@ -94,7 +95,10 @@ export async function* generateEncoder( } if (compactItems.length > 0) { `; if (property.functional || property.container !== "list") { if ( property.functional || (isNonFunctionalProperty(property) && property.container !== "list") ) { yield ` result[${JSON.stringify(property.compactName)}] = compactItems.length > 1 Loading Loading @@ -162,7 +166,7 @@ export async function* generateEncoder( yield ` ); `; if (!property.functional && property.container === "graph") { if (isNonFunctionalProperty(property) && property.container === "graph") { yield `array.push({ "@graph": element });`; } else { yield `array.push(element);`; Loading @@ -172,7 +176,7 @@ export async function* generateEncoder( if (array.length > 0) { const propValue = ( `; if (!property.functional && property.container === "list") { if (isNonFunctionalProperty(property) && property.container === "list") { yield `{ "@list": array }`; } else { yield `array`; Loading fedify/codegen/constructor.ts +8 −7 Original line number Diff line number Diff line import { getFieldName } from "./field.ts"; import { hasSingularAccessor, isNonFunctionalProperty } from "./schema.ts"; import type { PropertySchema, TypeSchema } from "./schema.ts"; import { areAllScalarTypes, Loading @@ -14,7 +15,7 @@ function generateParameterType( const range = property.range; const scalar = areAllScalarTypes(range, types); const code: string[] = []; if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { if (scalar) { code.push( `${property.singularName}?: ${getTypeNames(range, types)} | null;`, Loading @@ -27,7 +28,7 @@ function generateParameterType( ); } } if (!property.functional) { if (isNonFunctionalProperty(property)) { if (scalar) { code.push( `${property.pluralName}?: (${getTypeNames(range, types, true)})[];`, Loading Loading @@ -114,7 +115,7 @@ export async function* generateConstructor( } for (const property of type.properties) { const fieldName = await getFieldName(property.uri); if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { let typeGuards = getTypeGuards( property.range, types, Loading Loading @@ -142,7 +143,7 @@ export async function* generateConstructor( } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { let typeGuards = getTypeGuards(property.range, types, `v`); let typeNames = getTypeNames(property.range, types); const scalar = areAllScalarTypes(property.range, types); Loading @@ -154,7 +155,7 @@ export async function* generateConstructor( if ("${property.pluralName}" in values && \ values.${property.pluralName} != null) { `; if (property.singularAccessor) { if (isNonFunctionalProperty(property) && property.singularAccessor) { yield ` if ("${property.singularName}" in values && values.${property.singularName} != null) { Loading Loading @@ -229,7 +230,7 @@ export async function* generateCloner( for (const property of type.properties) { const fieldName = await getFieldName(property.uri); yield `clone.${fieldName} = this.${fieldName};`; if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { let typeGuards = getTypeGuards( property.range, types, Loading Loading @@ -257,7 +258,7 @@ export async function* generateCloner( } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { let typeGuards = getTypeGuards(property.range, types, `v`); let typeNames = getTypeNames(property.range, types); const scalar = areAllScalarTypes(property.range, types); Loading fedify/codegen/inspector.ts +3 −2 Original line number Diff line number Diff line import { getFieldName } from "./field.ts"; import { hasSingularAccessor, isNonFunctionalProperty } from "./schema.ts"; import type { TypeSchema } from "./schema.ts"; import { emitOverride } from "./type.ts"; Loading Loading @@ -52,14 +53,14 @@ export async function* generateInspector( } : v); `; if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { yield ` if (${localName}.length == 1) { proxy.${property.singularName} = ${localName}[0]; } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { yield ` if (${localName}.length > 1 || !(${JSON.stringify(property.singularName)} in proxy) Loading fedify/codegen/property.ts +5 −4 Original line number Diff line number Diff line import { pascalCase } from "es-toolkit"; import metadata from "../deno.json" with { type: "json" }; import { getFieldName } from "./field.ts"; import { hasSingularAccessor, isNonFunctionalProperty } from "./schema.ts"; import type { PropertySchema, TypeSchema } from "./schema.ts"; import { areAllScalarTypes, getTypeNames } from "./type.ts"; Loading Loading @@ -29,7 +30,7 @@ async function* generateProperty( const override = emitOverride(type.uri, types, property); const doc = `\n/** ${property.description.replaceAll("\n", "\n * ")}\n */\n`; if (areAllScalarTypes(property.range, types)) { if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { yield doc; yield `${override} get ${property.singularName}(): (${ getTypeNames(property.range, types) Loading @@ -45,7 +46,7 @@ async function* generateProperty( } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { yield doc; yield `get ${property.pluralName}(): (${ getTypeNames(property.range, types, true) Loading Loading @@ -161,7 +162,7 @@ async function* generateProperty( } `; if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { yield ` /** * Similar to Loading Loading @@ -230,7 +231,7 @@ async function* generateProperty( } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { yield ` /** * Similar to Loading Loading
.github/workflows/build.yaml +9 −9 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - run: deno task test --coverage=.cov --junit-path=.test-report.xml env: RUST_BACKTRACE: ${{ runner.debug }} Loading Loading @@ -124,7 +124,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading Loading @@ -181,7 +181,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading @@ -207,7 +207,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading @@ -230,7 +230,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - run: deno task hooks:pre-commit release-test: Loading @@ -248,7 +248,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading Loading @@ -283,7 +283,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading Loading @@ -449,7 +449,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - run: deno task codegen working-directory: ${{ github.workspace }}/fedify/ - uses: denoland/deployctl@v1 Loading Loading @@ -480,7 +480,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} - uses: denoland/setup-deno@v2 with: deno-version: "2.4.1" # FIXME: https://github.com/fedify-dev/fedify/issues/303 deno-version: v2.x - uses: pnpm/action-setup@v4 with: version: 10 Loading
fedify/codegen/codec.ts +7 −3 Original line number Diff line number Diff line import metadata from "../deno.json" with { type: "json" }; import { generateField, getFieldName } from "./field.ts"; import { isNonFunctionalProperty } from "./schema.ts"; import type { TypeSchema } from "./schema.ts"; import { areAllScalarTypes, Loading Loading @@ -94,7 +95,10 @@ export async function* generateEncoder( } if (compactItems.length > 0) { `; if (property.functional || property.container !== "list") { if ( property.functional || (isNonFunctionalProperty(property) && property.container !== "list") ) { yield ` result[${JSON.stringify(property.compactName)}] = compactItems.length > 1 Loading Loading @@ -162,7 +166,7 @@ export async function* generateEncoder( yield ` ); `; if (!property.functional && property.container === "graph") { if (isNonFunctionalProperty(property) && property.container === "graph") { yield `array.push({ "@graph": element });`; } else { yield `array.push(element);`; Loading @@ -172,7 +176,7 @@ export async function* generateEncoder( if (array.length > 0) { const propValue = ( `; if (!property.functional && property.container === "list") { if (isNonFunctionalProperty(property) && property.container === "list") { yield `{ "@list": array }`; } else { yield `array`; Loading
fedify/codegen/constructor.ts +8 −7 Original line number Diff line number Diff line import { getFieldName } from "./field.ts"; import { hasSingularAccessor, isNonFunctionalProperty } from "./schema.ts"; import type { PropertySchema, TypeSchema } from "./schema.ts"; import { areAllScalarTypes, Loading @@ -14,7 +15,7 @@ function generateParameterType( const range = property.range; const scalar = areAllScalarTypes(range, types); const code: string[] = []; if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { if (scalar) { code.push( `${property.singularName}?: ${getTypeNames(range, types)} | null;`, Loading @@ -27,7 +28,7 @@ function generateParameterType( ); } } if (!property.functional) { if (isNonFunctionalProperty(property)) { if (scalar) { code.push( `${property.pluralName}?: (${getTypeNames(range, types, true)})[];`, Loading Loading @@ -114,7 +115,7 @@ export async function* generateConstructor( } for (const property of type.properties) { const fieldName = await getFieldName(property.uri); if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { let typeGuards = getTypeGuards( property.range, types, Loading Loading @@ -142,7 +143,7 @@ export async function* generateConstructor( } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { let typeGuards = getTypeGuards(property.range, types, `v`); let typeNames = getTypeNames(property.range, types); const scalar = areAllScalarTypes(property.range, types); Loading @@ -154,7 +155,7 @@ export async function* generateConstructor( if ("${property.pluralName}" in values && \ values.${property.pluralName} != null) { `; if (property.singularAccessor) { if (isNonFunctionalProperty(property) && property.singularAccessor) { yield ` if ("${property.singularName}" in values && values.${property.singularName} != null) { Loading Loading @@ -229,7 +230,7 @@ export async function* generateCloner( for (const property of type.properties) { const fieldName = await getFieldName(property.uri); yield `clone.${fieldName} = this.${fieldName};`; if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { let typeGuards = getTypeGuards( property.range, types, Loading Loading @@ -257,7 +258,7 @@ export async function* generateCloner( } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { let typeGuards = getTypeGuards(property.range, types, `v`); let typeNames = getTypeNames(property.range, types); const scalar = areAllScalarTypes(property.range, types); Loading
fedify/codegen/inspector.ts +3 −2 Original line number Diff line number Diff line import { getFieldName } from "./field.ts"; import { hasSingularAccessor, isNonFunctionalProperty } from "./schema.ts"; import type { TypeSchema } from "./schema.ts"; import { emitOverride } from "./type.ts"; Loading Loading @@ -52,14 +53,14 @@ export async function* generateInspector( } : v); `; if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { yield ` if (${localName}.length == 1) { proxy.${property.singularName} = ${localName}[0]; } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { yield ` if (${localName}.length > 1 || !(${JSON.stringify(property.singularName)} in proxy) Loading
fedify/codegen/property.ts +5 −4 Original line number Diff line number Diff line import { pascalCase } from "es-toolkit"; import metadata from "../deno.json" with { type: "json" }; import { getFieldName } from "./field.ts"; import { hasSingularAccessor, isNonFunctionalProperty } from "./schema.ts"; import type { PropertySchema, TypeSchema } from "./schema.ts"; import { areAllScalarTypes, getTypeNames } from "./type.ts"; Loading Loading @@ -29,7 +30,7 @@ async function* generateProperty( const override = emitOverride(type.uri, types, property); const doc = `\n/** ${property.description.replaceAll("\n", "\n * ")}\n */\n`; if (areAllScalarTypes(property.range, types)) { if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { yield doc; yield `${override} get ${property.singularName}(): (${ getTypeNames(property.range, types) Loading @@ -45,7 +46,7 @@ async function* generateProperty( } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { yield doc; yield `get ${property.pluralName}(): (${ getTypeNames(property.range, types, true) Loading Loading @@ -161,7 +162,7 @@ async function* generateProperty( } `; if (property.functional || property.singularAccessor) { if (hasSingularAccessor(property)) { yield ` /** * Similar to Loading Loading @@ -230,7 +231,7 @@ async function* generateProperty( } `; } if (!property.functional) { if (isNonFunctionalProperty(property)) { yield ` /** * Similar to Loading