![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@latitude-data/sql-compiler
Advanced tools
Compiler for Latitude's custom sql sintax based on svelte
import { emptyMetadata, readMetadata } from '..' import CompileError from '../error/error' import { describe, it, expect, beforeEach, vi } from 'vitest'
describe('config tags', async () => {
it('extracts defined configurations correctly', async () => {
const query = {@config foo = 5} {@config bar = "foo"} {@config baz = true} Rest of the query
const { config } = await readMetadata({ query })
expect(config).toEqual({
foo: 5,
bar: 'foo',
baz: true,
})
})
it('fails when a config tag is not at root level', async () => {
const query = {#if true} {@config foo = 5} {/if}
try {
await readMetadata({ query })
} catch (e) {
expect(e).toBeInstanceOf(CompileError)
expect((e as CompileError).code).toBe('config-inside-block')
}
})
it('fails when a config tag is not a valid assignment expression', async () => {
const query = {@config foo 5}
try {
await readMetadata({ query })
} catch (e) {
expect(e).toBeInstanceOf(CompileError)
expect((e as CompileError).code).toBe('invalid-config-args')
}
})
it('fails when a config value is not a literal', async () => {
const query = {@config foo = 5 + 5}
try {
await readMetadata({ query })
} catch (e) {
expect(e).toBeInstanceOf(CompileError)
expect((e as CompileError).code).toBe('invalid-config-value')
}
})
it('fails when a config is already defined', async () => {
const query = {@config foo = 5} {@config foo = 10}
try {
await readMetadata({ query })
} catch (e) {
expect(e).toBeInstanceOf(CompileError)
expect((e as CompileError).code).toBe('config-already-defined')
}
})
})
describe('supported methods', async () => { function mockSupportedMethod() { return { requirements: {}, resolve: vi.fn(() => Promise.resolve()), readMetadata: vi.fn(() => Promise.resolve(emptyMetadata())), } }
beforeEach(() => { vi.clearAllMocks() })
it('extracts supported methods present in the query correctly', async () => {
const query = {foo()} {bar()} {baz()}
const supportedMethods = {
foo: mockSupportedMethod(),
bar: mockSupportedMethod(),
}
const { methods } = await readMetadata({ query, supportedMethods })
expect(methods).toContain('foo')
expect(methods).toContain('bar')
})
it('does not extract method calls that are not from supported methods', async () => {
const query = {foo()} {bar()} {baz()}
const supportedMethods = {
foo: mockSupportedMethod(),
}
const { methods } = await readMetadata({ query, supportedMethods })
expect(methods).toContain('foo')
expect(methods).not.toContain('bar')
expect(methods).not.toContain('baz')
})
it('does not extract supported methods that are not present in the query', async () => {
const query = {foo()}
const supportedMethods = {
foo: mockSupportedMethod(),
bar: mockSupportedMethod(),
}
const { methods } = await readMetadata({ query, supportedMethods })
expect(methods).toContain('foo')
expect(methods).not.toContain('bar')
})
it('does not actually run extracted methods', async () => {
const query = {foo()}
const supportedMethods = {
foo: mockSupportedMethod(),
bar: mockSupportedMethod(),
}
const { methods } = await readMetadata({ query, supportedMethods })
expect(methods).toContain('foo')
expect(supportedMethods.foo.resolve).not.toHaveBeenCalled()
}) })
FAQs
Compiler for Latitude's custom sql sintax based on svelte
The npm package @latitude-data/sql-compiler receives a total of 25 weekly downloads. As such, @latitude-data/sql-compiler popularity was classified as not popular.
We found that @latitude-data/sql-compiler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.