repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
sarahM0/cts
src/webgpu/api/operation/rendering/blending.spec.ts
<filename>src/webgpu/api/operation/rendering/blending.spec.ts<gh_stars>0 export const description = ` Test blending results. TODO: - Test result for all combinations of args (make sure each case is distinguishable from others - Test underflow/overflow has consistent behavior - ? `; import { makeTestGroup } from '../....
sarahM0/cts
src/webgpu/shader/execution/builtin/logical_built_in_functions.spec.ts
export const description = `WGSL execution test. Section: Logical built-in functions`; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { GPUTest } from '../../../gpu_test.js'; export const g = makeTestGroup(GPUTest); g.test('logical_builtin_functions,scalar_select') .uniqueId('50...
sarahM0/cts
src/webgpu/util/memory.ts
/** * Helper to exhaust VRAM until there is less than 64 MB of capacity. Returns * an opaque closure which can be called to free the allocated resources later. */ export async function exhaustVramUntilUnder64MB(device: GPUDevice) { const allocateUntilOom = async (device: GPUDevice, size: number) => { const buf...
sarahM0/cts
src/common/tools/crawl.ts
<filename>src/common/tools/crawl.ts // Node can look at the filesystem, but JS in the browser can't. // This crawls the file tree under src/suites/${suite} to generate a (non-hierarchical) static // listing file that can then be used in the browser to load the modules containing the tests. import * as fs from 'fs'; im...
sarahM0/cts
src/stress/queries/occlusion.spec.ts
export const description = ` Stress tests for occlusion queries. `; import { makeTestGroup } from '../../common/framework/test_group.js'; import { GPUTest } from '../../webgpu/gpu_test.js'; export const g = makeTestGroup(GPUTest); g.test('many').desc(`Tests a huge number of occlusion queries in a render pass.`).unim...
sarahM0/cts
src/unittests/query_string.spec.ts
<filename>src/unittests/query_string.spec.ts export const description = ` Unit tests for TestQuery strings. `; import { makeTestGroup } from '../common/framework/test_group.js'; import { compareQueries, Ordering } from '../common/internal/query/compare.js'; import { TestQuery, TestQuerySingleCase, TestQueryMulti...
sarahM0/cts
src/common/internal/test_suite_listing.ts
// A listing of all specs within a single suite. This is the (awaited) type of // `groups` in '{cts,unittests}/listing.ts' and `listing` in the auto-generated // 'out/{cts,unittests}/listing.js' files (see tools/gen_listings). export type TestSuiteListing = TestSuiteListingEntry[]; export type TestSuiteListingEntry = ...
sarahM0/cts
src/webgpu/api/operation/uncapturederror.spec.ts
export const description = ` Tests for GPUDevice.onuncapturederror. `; import { Fixture } from '../../../common/framework/fixture.js'; import { makeTestGroup } from '../../../common/framework/test_group.js'; export const g = makeTestGroup(Fixture); g.test('constructor') .desc( `GPUUncapturedErrorEvent construc...
sarahM0/cts
src/webgpu/api/operation/vertex_state/correctness.spec.ts
export const description = ` TODO: Test more corner case values for Float16 / Float32 (INF, NaN, +-0, ...) and reduce the float tolerance. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { assert, memcpy, unreachable } from '../../../../common/util/util.js'; import { kMaxVertexA...
sarahM0/cts
src/common/runtime/helper/test_worker.ts
<reponame>sarahM0/cts<filename>src/common/runtime/helper/test_worker.ts<gh_stars>10-100 import { LogMessageWithStack } from '../../internal/logging/log_message.js'; import { TransferredTestCaseResult, LiveTestCaseResult } from '../../internal/logging/result.js'; import { TestCaseRecorder } from '../../internal/logging/...
sarahM0/cts
src/webgpu/api/validation/initialization/requestDevice.spec.ts
export const description = ` Test validation conditions for requestDevice. `; import { Fixture } from '../../../../common/framework/fixture.js'; import { makeTestGroup } from '../../../../common/framework/test_group.js'; export const g = makeTestGroup(Fixture); g.test('features,nonexistent') .desc('requestDevice w...
sarahM0/cts
src/common/internal/file_loader.ts
<filename>src/common/internal/file_loader.ts import { IterableTestGroup } from '../internal/test_group.js'; import { assert } from '../util/util.js'; import { parseQuery } from './query/parseQuery.js'; import { TestQuery } from './query/query.js'; import { TestSuiteListing } from './test_suite_listing.js'; import { lo...
sarahM0/cts
src/stress/memory/oom.spec.ts
export const description = ` Stress tests covering robustness when available VRAM is exhausted. `; import { makeTestGroup } from '../../common/framework/test_group.js'; import { GPUTest } from '../../webgpu/gpu_test.js'; import { exhaustVramUntilUnder64MB } from '../../webgpu/util/memory.js'; export const g = makeTes...
sarahM0/cts
src/webgpu/api/validation/resource_usages/texture/in_render_misc.spec.ts
<reponame>sarahM0/cts export const description = ` TODO: - 2 views: upon the same subresource, or different subresources of the same texture - texture usages in copies and in render pass - consecutively set bind groups on the same index (@Richard-Yunchao: Maybe I can combine this one with the above tests. The t...
sarahM0/cts
src/webgpu/api/validation/layout_shader_compat.spec.ts
export const description = ` TODO: - interface matching between pipeline layout and shader - x= {compute, vertex, fragment, vertex+fragment}, visibilities - x= bind group index values, binding index values, multiple bindings - x= types of bindings - x= {equal, superset, subset} `; import { makeTestGrou...
sarahM0/cts
src/common/runtime/helper/test_worker-worker.ts
<gh_stars>10-100 import { setBaseResourcePath } from '../../framework/resources.js'; import { DefaultTestFileLoader } from '../../internal/file_loader.js'; import { Logger } from '../../internal/logging/logger.js'; import { parseQuery } from '../../internal/query/parseQuery.js'; import { TestQueryWithExpectation } from...
sarahM0/cts
src/webgpu/web_platform/canvas/context_creation.spec.ts
<gh_stars>10-100 export const description = ` Tests for canvas context creation. Note there are no context creation attributes for WebGPU (as of this writing). Options are configured in configure() instead. `; import { Fixture } from '../../../common/framework/fixture.js'; import { makeTestGroup } from '../../../comm...
sarahM0/cts
src/webgpu/api/operation/rendering/indirect_draw.spec.ts
<gh_stars>0 export const description = ` Tests for the indirect-specific aspects of drawIndirect/drawIndexedIndirect. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { GPUTest } from '../../../gpu_test.js'; export const g = makeTestGroup(GPUTest); const filled = new Uint8Array([...
sarahM0/cts
src/webgpu/api/validation/encoding/cmds/render_pass.spec.ts
<reponame>sarahM0/cts export const description = ` Validation tests for render pass encoding. Does **not** test usage scopes (resource_usages/), GPUProgrammablePassEncoder (programmable_pass), dynamic state (dynamic_render_state.spec.ts), or GPURenderEncoderBase (render.spec.ts). TODO: - executeBundles: - with {ze...
sarahM0/cts
src/demo/file_depth_2/in_single_child_dir/r.spec.ts
<reponame>sarahM0/cts export const description = 'Description for r.spec.ts'; import { makeTestGroup } from '../../../common/framework/test_group.js'; import { UnitTest } from '../../../unittests/unit_test.js'; export const g = makeTestGroup(UnitTest);
sarahM0/cts
src/common/util/navigator_gpu.ts
/// <reference types="@webgpu/types" /> import { assert } from './util.js'; /** * Finds and returns the `navigator.gpu` object (or equivalent, for non-browser implementations). * Throws an exception if not found. */ function defaultGPUProvider(): GPU { assert( typeof navigator !== 'undefined' && navigator.gp...
sarahM0/cts
src/common/util/data_tables.ts
import { ResolveType, ZipKeysWithValues } from './types.js'; export type valueof<K> = K[keyof K]; export function keysOf<T extends string>(obj: { [k in T]: unknown }): readonly T[] { return (Object.keys(obj) as unknown[]) as T[]; } export function numericKeysOf<T>(obj: object): readonly T[] { return (Object.keys...
sarahM0/cts
src/stress/adapter/device_allocation.ts
<gh_stars>10-100 export const description = ` Stress tests for GPUAdapter.requestDevice. `; import { Fixture } from '../../common/framework/fixture.js'; import { makeTestGroup } from '../../common/framework/test_group.js'; export const g = makeTestGroup(Fixture); g.test('coexisting') .desc( `Tests allocation o...
sarahM0/cts
src/stress/texture/large.spec.ts
<filename>src/stress/texture/large.spec.ts export const description = ` Stress tests covering usage of very large textures. `; import { makeTestGroup } from '../../common/framework/test_group.js'; import { GPUTest } from '../../webgpu/gpu_test.js'; export const g = makeTestGroup(GPUTest); g.test('loading,2d') .des...
sarahM0/cts
src/common/tools/gen_listings.ts
import * as fs from 'fs'; import * as path from 'path'; import * as process from 'process'; import { crawl } from './crawl.js'; function usage(rc: number): void { console.error(`Usage: tools/gen_listings [options] [OUT_DIR] [SUITE_DIRS...] For each suite in SUITE_DIRS, generate listings and write each listing.js i...
sarahM0/cts
src/common/internal/query/json_param_value.ts
<filename>src/common/internal/query/json_param_value.ts<gh_stars>0 import { assert, sortObjectByKey } from '../../util/util.js'; import { JSONWithUndefined } from '../params_utils.js'; // JSON can't represent `undefined` and by default stores it as `null`. // Instead, store `undefined` as this magic string value in JS...
sarahM0/cts
src/webgpu/api/validation/capability_checks/features/depth_clamping.spec.ts
<gh_stars>10-100 export const description = ` Tests 'depth-clamping' must be enabled for GPUDepthStencilState.clampDepth to be enabled. `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; import { ValidationTest } from '../../validation_test.js'; export const g = makeTestGroup(Validation...
sarahM0/cts
src/unittests/check_contents.spec.ts
<gh_stars>10-100 export const description = `Unit tests for check_contents`; import { Fixture } from '../common/framework/fixture.js'; import { makeTestGroup } from '../common/internal/test_group.js'; import { ErrorWithExtra } from '../common/util/util.js'; import { checkElementsEqual } from '../webgpu/util/check_cont...
sarahM0/cts
src/webgpu/shader/execution/builtin/min.spec.ts
<gh_stars>0 export const description = ` Execution Tests for the 'min' builtin function `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { GPUTest } from '../../../gpu_test.js'; import { i32, i32Bits, TypeI32, TypeU32, u32 } from '../../../util/conversion.js'; import { run } from ...
sarahM0/cts
src/webgpu/api/operation/command_buffer/render/dynamic_state.spec.ts
export const description = ` Tests of the behavior of the viewport/scissor/blend/reference states. TODO: - {viewport, scissor rect, blend color, stencil reference}: Test rendering result with {various values}. - Set the state in different ways to make sure it gets the correct value in the end: { - state ...
sarahM0/cts
src/webgpu/util/command_buffer_maker.ts
import { ResourceState, GPUTest } from '../gpu_test.js'; export const kRenderEncodeTypes = ['render pass', 'render bundle'] as const; export type RenderEncodeType = typeof kRenderEncodeTypes[number]; export const kProgrammableEncoderTypes = ['compute pass', ...kRenderEncodeTypes] as const; export type ProgrammableEnco...
sarahM0/cts
src/webgpu/api/operation/labels.spec.ts
export const description = ` For every create function, the descriptor.label is carried over to the object.label. TODO: implement `; import { makeTestGroup } from '../../../common/framework/test_group.js'; import { GPUTest } from '../../gpu_test.js'; export const g = makeTestGroup(GPUTest);
sarahM0/cts
src/stress/device/render_pipeline_allocation.spec.ts
export const description = ` Stress tests for allocation of GPURenderPipeline objects through GPUDevice. `; import { makeTestGroup } from '../../common/framework/test_group.js'; import { GPUTest } from '../../webgpu/gpu_test.js'; export const g = makeTestGroup(GPUTest); g.test('coexisting') .desc(`Tests allocation...
sarahM0/cts
src/webgpu/api/operation/buffers/threading.spec.ts
<reponame>sarahM0/cts export const description = ` TODO: - Copy GPUBuffer to another thread while {pending, mapped mappedAtCreation} on {same,diff} thread - Destroy on one thread while {pending, mapped, mappedAtCreation, mappedAtCreation+unmap+mapped} on another thread. `; import { makeTestGroup } from '../../../../...
sarahM0/cts
src/webgpu/api/validation/queue/submit.spec.ts
<gh_stars>10-100 export const description = ` Tests submit validation. Note: destroyed buffer/texture/querySet are tested in destroyed/. (unless it gets moved here) Note: buffer map state is tested in ./buffer_mapped.spec.ts. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { Vali...
sarahM0/cts
src/stress/device/texture_allocation.spec.ts
<filename>src/stress/device/texture_allocation.spec.ts<gh_stars>10-100 export const description = ` Stress tests for allocation of GPUTexture objects through GPUDevice. `; import { makeTestGroup } from '../../common/framework/test_group.js'; import { GPUTest } from '../../webgpu/gpu_test.js'; export const g = makeTes...
sarahM0/cts
src/webgpu/shader/types.ts
<reponame>sarahM0/cts import { keysOf } from '../../common/util/data_tables.js'; import { assert } from '../../common/util/util.js'; import { align } from '../util/math.js'; const kArrayLength = 3; export type ContainerType = 'scalar' | 'vector' | 'matrix' | 'atomic' | 'array'; export type ScalarType = 'i32' | 'u32' ...
sarahM0/cts
src/common/framework/test_group.ts
export { makeTestGroup } from '../internal/test_group.js';
sarahM0/cts
src/webgpu/api/validation/query_set/destroy.spec.ts
export const description = ` Destroying a query set more than once is allowed. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { ValidationTest } from '../validation_test.js'; export const g = makeTestGroup(ValidationTest); g.test('twice').fn(async t => { const qset = t.device...
sarahM0/cts
src/webgpu/api/validation/encoding/queries/pipeline_statistics.spec.ts
export const description = ` Validation for encoding pipeline statistics queries. Excludes query begin/end balance and nesting (begin_end.spec.ts) and querySet/queryIndex (general.spec.ts). TODO: - Test pipelineStatistics with {undefined, empty, duplicated, full (control case)} values `; import { makeTestGroup } from...
sarahM0/cts
src/webgpu/api/validation/encoding/queries/common.ts
import { GPUTest } from '../../../../gpu_test.js'; export function createQuerySetWithType( t: GPUTest, type: GPUQueryType, count: GPUSize32 ): GPUQuerySet { return t.device.createQuerySet({ type, count, pipelineStatistics: type === 'pipeline-statistics' ? (['clipper-invocations'] as const) : ...
sarahM0/cts
src/common/framework/params_builder.ts
<filename>src/common/framework/params_builder.ts import { Merged, mergeParams } from '../internal/params_utils.js'; // ================================================================ // "Public" ParamsBuilder API / Documentation // ================================================================ /** * Provides doc ...
sarahM0/cts
src/webgpu/shader/execution/builtin/atan.spec.ts
export const description = ` Execution Tests for the 'atan' builtin function `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { GPUTest } from '../../../gpu_test.js'; import { f32, f32Bits, TypeF32 } from '../../../util/conversion.js'; import { Case, Config, kBit, run, ulpThreshol...
sarahM0/cts
src/webgpu/api/operation/resource_init/check_texture/by_copy.ts
import { assert } from '../../../../../common/util/util.js'; import { EncodableTextureFormat, kTextureFormatInfo } from '../../../../capability_info.js'; import { virtualMipSize } from '../../../../util/texture/base.js'; import { CheckContents } from '../texture_zero.spec.js'; export const checkContentsByBufferCopy: C...
sarahM0/cts
src/webgpu/api/validation/queue/writeBuffer.spec.ts
<reponame>sarahM0/cts<filename>src/webgpu/api/validation/queue/writeBuffer.spec.ts<gh_stars>10-100 export const description = ` Tests writeBuffer validation. Note: destroyed buffer is tested in destroyed/. Note: buffer map state is tested in ./buffer_mapped.spec.ts. `; import { makeTestGroup } from '../../../../commo...
sarahM0/cts
src/webgpu/api/validation/encoding/queries/resolveQuerySet.spec.ts
<gh_stars>10-100 export const description = ` Validation tests for resolveQuerySet. `; import { makeTestGroup } from '../../../../../common/framework/test_group.js'; import { GPUConst } from '../../../../constants.js'; import { ValidationTest } from '../../validation_test.js'; export const g = makeTestGroup(Validation...
sarahM0/cts
src/webgpu/api/operation/render_pipeline/vertex_only_render_pipeline.spec.ts
<filename>src/webgpu/api/operation/render_pipeline/vertex_only_render_pipeline.spec.ts export const description = ` Test vertex-only render pipeline. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { GPUTest } from '../../../gpu_test.js'; class F extends GPUTest {} export const ...
sarahM0/cts
src/webgpu/api/validation/encoding/render_bundle.spec.ts
export const description = ` TODO: - test creating a render bundle, and if it's valid, test that executing it is not an error - color formats {all possible formats} {zero, one, multiple} - depth/stencil format {unset, all possible formats} - ? `; import { makeTestGroup } from '../../../../common/framework/test...
sarahM0/cts
src/webgpu/api/operation/sampling/filter_mode.spec.ts
export const description = ` Tests the behavior of different filtering modes in minFilter/magFilter/mipmapFilter. TODO: - Test exact sampling results with small tolerance. Tests should differentiate between different values for all three filter modes to make sure none are missed or incorrect in implementations. - (L...
sarahM0/cts
src/common/internal/query/encode_selectively.ts
<reponame>sarahM0/cts<gh_stars>10-100 /** * Encodes a stringified TestQuery so that it can be placed in a `?q=` parameter in a URL. * * `encodeURIComponent` encodes in accordance with `application/x-www-form-urlencoded`, * but URLs don't actually have to be as strict as HTML form encoding * (we interpret this pure...
sarahM0/cts
src/webgpu/api/validation/buffer/destroy.spec.ts
export const description = ` Validation tests for GPUBuffer.destroy. `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { kBufferUsages } from '../../../capability_info.js'; import { GPUConst } from '../../../constants.js'; import { ValidationTest } from '../validation_test.js'; exp...
sarahM0/cts
src/stress/memory/churn.spec.ts
export const description = ` Stress tests covering robustness in the presence of heavy buffer and texture memory churn. `; import { makeTestGroup } from '../../common/framework/test_group.js'; import { GPUTest } from '../../webgpu/gpu_test.js'; export const g = makeTestGroup(GPUTest); g.test('churn') .desc( `A...
sarahM0/cts
src/webgpu/api/operation/render_pipeline/alpha_to_coverage.spec.ts
export const description = ` TODO: - for sampleCount = 4, alphaToCoverageEnabled = true and various combinations of: - rasterization masks - increasing alpha values of the first color output including { < 0, = 0, = 1/16, = 2/16, ..., = 15/16, = 1, > 1 } - alpha values of the second color output = { 0, 0.5, ...
sarahM0/cts
src/unittests/params_builder_and_utils.spec.ts
<gh_stars>10-100 export const description = ` Unit tests for parameterization helpers. `; import { kUnitCaseParamsBuilder, CaseSubcaseIterable, ParamsBuilderBase, builderIterateCasesWithSubcases, } from '../common/framework/params_builder.js'; import { makeTestGroup } from '../common/framework/test_group.js'; ...
sarahM0/cts
src/stress/device/bind_group_allocation.spec.ts
<reponame>sarahM0/cts export const description = ` Stress tests for allocation of GPUBindGroup objects through GPUDevice. `; import { makeTestGroup } from '../../common/framework/test_group.js'; import { GPUTest } from '../../webgpu/gpu_test.js'; export const g = makeTestGroup(GPUTest); g.test('coexisting') .desc(...
sarahM0/cts
src/stress/queries/timestamps.spec.ts
<gh_stars>10-100 export const description = ` Stress tests for timestamp queries. `; import { makeTestGroup } from '../../common/framework/test_group.js'; import { GPUTest } from '../../webgpu/gpu_test.js'; export const g = makeTestGroup(GPUTest); g.test('command_encoder_one_query_set') .desc( `Tests a huge nu...
sarahM0/cts
src/webgpu/api/validation/attachment_compatibility.spec.ts
export const description = ` Validation for attachment compatibility between render passes, bundles, and pipelines TODO: Add sparse color attachment compatibility test when defined by specification `; import { makeTestGroup } from '../../../common/framework/test_group.js'; import { range } from '../../../common/util/...
sarahM0/cts
src/webgpu/util/copy_to_texture.ts
import { GPUTest } from '../gpu_test.js'; import { checkElementsEqual, checkElementsBetween } from './check_contents.js'; import { align } from './math.js'; import { kBytesPerRowAlignment } from './texture/layout.js'; export function isFp16Format(format: GPUTextureFormat): boolean { switch (format) { case 'r16f...
sarahM0/cts
src/unittests/test_query.spec.ts
<reponame>sarahM0/cts export const description = ` Tests for TestQuery `; import { makeTestGroup } from '../common/framework/test_group.js'; import { TestQueryMultiFile, TestQueryMultiTest, TestQueryMultiCase, TestQuerySingleCase, TestQuery, } from '../common/internal/query/query.js'; import { UnitTest } fro...
sarahM0/cts
src/webgpu/shader/execution/builtin/abs.spec.ts
export const description = ` Execution Tests for the 'abs' builtin function `; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { GPUTest } from '../../../gpu_test.js'; import { f32, f32Bits, i32Bits, TypeF32, TypeI32, TypeU32, u32Bits, } from '../../../util/conversion.j...
sarahM0/cts
src/unittests/maths.spec.ts
export const description = ` Util math unit tests. `; import { makeTestGroup } from '../common/framework/test_group.js'; import { kBit } from '../webgpu/shader/execution/builtin/builtin.js'; import { f32, f32Bits, Scalar } from '../webgpu/util/conversion.js'; import { diffULP, nextAfter } from '../webgpu/util/math.js'...
sarahM0/cts
src/common/internal/query/parseQuery.ts
import { assert } from '../../util/util.js'; import { TestParamsRW, JSONWithUndefined, badParamValueChars, paramKeyIsPublic, } from '../params_utils.js'; import { parseParamValue } from './json_param_value.js'; import { TestQuery, TestQueryMultiFile, TestQueryMultiTest, TestQueryMultiCase, TestQueryS...
sarahM0/cts
src/webgpu/shader/execution/shader_io/compute_builtins.spec.ts
<reponame>sarahM0/cts export const description = `Test compute shader builtin variables`; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { iterRange } from '../../../../common/util/util.js'; import { GPUTest } from '../../../gpu_test.js'; export const g = makeTestGroup(GPUTest); /...
sarahM0/cts
src/webgpu/shader/execution/builtin/integer_built_in_functions.spec.ts
export const description = `WGSL execution test. Section: Integer built-in functions`; import { makeTestGroup } from '../../../../common/framework/test_group.js'; import { GPUTest } from '../../../gpu_test.js'; export const g = makeTestGroup(GPUTest); g.test('integer_builtin_functions,unsigned_clamp') .uniqueId('3...
upstash/upstash-kafka
examples/cloudflare-worker/bindings.d.ts
<reponame>upstash/upstash-kafka export interface Bindings { UPSTASH_KAFKA_REST_URL: string UPSTASH_KAFKA_REST_USERNAME: string UPSTASH_KAFKA_REST_PASSWORD: string }
upstash/upstash-kafka
examples/cloudflare-worker/src/index.ts
import { Kafka } from "@upstash/kafka" import type { Bindings } from "bindings" export default { async fetch(_request: Request, env: Bindings) { const kafka = new Kafka({ url: env.UPSTASH_KAFKA_REST_URL, username: env.UPSTASH_KAFKA_REST_USERNAME, password: env.UPSTASH_KAFKA_REST_PASSWORD, }...
upstash/upstash-kafka
pkg/produce.test.ts
import { kafka, Topic } from "./test_setup" import { expect, it } from "@jest/globals" it("publishes a single message succesfully", async () => { const p = kafka.producer() const c = kafka.consumer() const message = { hello: "test" } const header = { key: "signature", value: "abcd" } const { partition, offs...
upstash/upstash-kafka
pkg/index.ts
export * from "./kafka" export * from "./error" export * from "./types"
upstash/upstash-kafka
pkg/test_setup.ts
import { Kafka } from "./kafka" import { config } from "dotenv" config() const url = process.env["UPSTASH_KAFKA_REST_URL"] if (!url) { throw new Error("UPSTASH_KAFKA_REST_URL env missing") } const username = process.env["UPSTASH_KAFKA_REST_USERNAME"] if (!username) { throw new Error("UPSTASH_KAFKA_REST_USERNAME en...
upstash/upstash-kafka
pkg/base64.ts
/** * Encode a string as base64 * * Credit to https://base64.guru/developers/javascript/examples/polyfill */ export function base64(origin: string): string { const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" const len = origin.length - 1 let i = -1 let encoded = "" whi...
upstash/upstash-kafka
pkg/test_teardown.ts
<filename>pkg/test_teardown.ts import { kafka } from "./test_setup" export default async function teardown(): Promise<void> { const a = kafka.admin() const existingConsumers = await a.consumers() await Promise.all( existingConsumers.flatMap((group) => group.instances.map((instance) => a.removeConsumerIn...
upstash/upstash-kafka
pkg/error.ts
/** * Result of a bad request to upstash */ export class UpstashError extends Error { public readonly result: string public readonly error: string public readonly status: number constructor(res: { result: string; error: string; status: number }) { super(res.error) this.name = "UpstashError" this.r...
upstash/upstash-kafka
cmd/removeConsumerGroups.ts
import { Kafka } from "../pkg/kafka" import { config } from "dotenv" config() async function main() { const url = process.env["UPSTASH_KAFKA_REST_URL"] if (!url) { throw new Error("Could not find url") } const username = process.env["UPSTASH_KAFKA_REST_USERNAME"] if (!username) { throw new Error("Cou...
upstash/upstash-kafka
pkg/types.ts
<filename>pkg/types.ts<gh_stars>10-100 export type Header = { key: string; value: string } export type Message = { topic: string partition: number offset: number timestamp: number key: string value: string headers: Header[] }
shwilliam/fullstack-ts-boiler
client/src/graphql/index.ts
<gh_stars>0 import { apolloClient } from './client' import { GraphQLError } from 'graphql' import { FetchResult } from 'apollo-boost' import { AllPostsQuery, AllPostsDocument, AddPostMutation, AddPostMutationVariables, AddPostDocument, NewPostInput as INewPostInput, Post as IPost, } from './generated'; e...
shwilliam/fullstack-ts-boiler
client/src/App.tsx
import React from 'react' import { NewPostForm, PostList } from './components' import { StoreContextProvider } from './context/store' const App = () => ( <StoreContextProvider> <NewPostForm/> <PostList/> </StoreContextProvider> ) export default App
shwilliam/fullstack-ts-boiler
client/src/components/PostList.tsx
import React, { useContext } from 'react' import { Post } from '../graphql' import { StoreContext } from '../context/store' const PostList = () => { const {posts} = useContext(StoreContext) return ( <ul> {posts ? posts.map((post: Post) => <li key={post.id}>{post.title}</li>) : <p>loading...
shwilliam/fullstack-ts-boiler
client/src/components/NewPostForm.tsx
import React, { useState, FormEvent, useContext } from 'react' import { StoreContext } from '../context/store' const NewPostForm = () => { const {publish} = useContext(StoreContext) const [titleInput, setTitleInput] = useState('') const [contentInput, setContentInput] = useState('') const onPostSubmit = (e: F...
shwilliam/fullstack-ts-boiler
server/src/repository.ts
<gh_stars>0 import fs from 'fs' import { Post } from './models/Post' import { NewPostInput } from './models/NewPostInput' const STATE_FILE = './data/blog.json' let _state: Post[] = null async function readFile(filename: string): Promise<string> { return new Promise((resolve, reject) => { fs.readFile(filename, (...
shwilliam/fullstack-ts-boiler
client/src/components/index.ts
import NewPostForm from './NewPostForm' import PostList from './PostList' export { NewPostForm, PostList }
shwilliam/fullstack-ts-boiler
server/src/models/FeedResolver.ts
import { Query, Mutation, Arg } from 'type-graphql' import { getAllPosts, addPost, } from '../repository' import { Post } from './Post' import { NewPostInput } from './NewPostInput' export class FeedResolver { @Query(returns => [Post]) public async allPosts(): Promise<Post[]> { return await getAllPosts() ...
shwilliam/fullstack-ts-boiler
server/src/models/NewPostInput.ts
import { InputType, Field } from 'type-graphql' import { Post } from './Post' @InputType({ description: 'Input type for new post' }) export class NewPostInput implements Partial<Post> { @Field() title: string; @Field() content: string; }
shwilliam/fullstack-ts-boiler
server/src/server.ts
<reponame>shwilliam/fullstack-ts-boiler<filename>server/src/server.ts import 'reflect-metadata' import { ApolloServer } from 'apollo-server' import { FeedResolver } from './models/FeedResolver' import { buildSchema } from 'type-graphql' (async (): Promise<void> => { const server = new ApolloServer({ schema: awai...
shwilliam/fullstack-ts-boiler
client/src/context/store.tsx
import React, { createContext, useState, useEffect, ReactNode } from 'react' import { getAllPosts, addPost, Post, NewPostInput } from '../graphql' const StoreContext = createContext<IStore>({ posts: [], publish: () => {} }) const StoreContextProvider = (props: {children: ReactNode}) => { const [posts, setPosts] = u...
shwilliam/fullstack-ts-boiler
client/src/graphql/generated.tsx
<reponame>shwilliam/fullstack-ts-boiler import gql from 'graphql-tag'; import * as ApolloReactCommon from '@apollo/react-common'; import * as React from 'react'; import * as ApolloReactComponents from '@apollo/react-components'; import * as ApolloReactHoc from '@apollo/react-hoc'; export type Maybe<T> = T | null; expor...
shwilliam/fullstack-ts-boiler
server/src/models/Post.ts
<gh_stars>0 import { ObjectType, Field, ID } from 'type-graphql' import shortid from 'shortid' @ObjectType() export class Post { @Field(type => ID) id: string; @Field() title: string; @Field() content: string; constructor(init: Partial<Post>) { Object.assign(this, init) this.id = shortid.gener...
shwilliam/fullstack-ts-boiler
client/src/graphql/client.ts
<reponame>shwilliam/fullstack-ts-boiler import {ApolloClient, ApolloLink, HttpLink, InMemoryCache} from 'apollo-boost' import {onError} from 'apollo-link-error' const httpLink = new HttpLink({ uri: 'http://localhost:80', }) const logErrorsLink = onError(({graphQLErrors, networkError}) => { if (graphQLErrors) { ...
Futurejason/pxt-magicbitssss
main.ts
/* <EMAIL> modified from pxt-servo/servodriver.ts load dependency "magicbit": "file:../pxt-magicbit" */ enum Offset { //% block=one ONE = 0, //% block=two TWO = 1, //% block=three THREE = 2, //% block=four FOUR = 3 } // enum IrPins{ // P0= 3, // P1= 2, // P2= 1, // ...
liyiligang/mxui
web/src/base/filter.ts
<reponame>liyiligang/mxui /* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by ap...
liyiligang/mxui
web/vite.config.ts
import vue from '@vitejs/plugin-vue' module.exports = { plugins:[vue()], build:{ outDir:"../bin/web" }, optimizeDeps: { include: ["protobufjs/minimal", "element-plus/lib/locale/lang/zh-cn", "dayjs/locale/zh-cn", "echarts/core", "echarts/charts", "echarts/renderers", "echarts/co...
liyiligang/mxui
web/src/base/refresh.ts
/* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
liyiligang/mxui
web/src/base/defaultVal.ts
<filename>web/src/base/defaultVal.ts /* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless req...
liyiligang/mxui
web/src/base/convert.ts
/* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
liyiligang/mxui
web/src/components/tableInfiniteScroll/tableInfiniteScroll.ts
/* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
liyiligang/mxui
web/src/main.ts
/* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
liyiligang/mxui
web/src/base/websocket.ts
/* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
liyiligang/mxui
web/src/router.ts
/* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
liyiligang/mxui
web/src/base/request.ts
/* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to ...
liyiligang/mxui
web/src/base/i18n.ts
<gh_stars>100-1000 /* * Copyright 2021 liyiligang. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicabl...
liyiligang/mxui
web/src/proto/manage.d.ts
import * as $protobuf from "protobufjs"; /** Namespace protoManage. */ export namespace protoManage { /** Order enum. */ enum Order { Unknow = 0, ManagerUpdate = 101, ManagerDel = 102, NodeFuncCallReq = 608, NodeFuncCallAns = 609, NodeReportUpdateVal = 704, ...