repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
amorimjuliana/sdk-js
src/evaluator.ts
<filename>src/evaluator.ts import {JsonObject, JsonValue} from './json'; import {TokenProvider} from './token'; import {EVALUATION_ENDPOINT_URL, MAX_EXPRESSION_LENGTH} from './constants'; import {formatMessage} from './error'; import {getLength, getLocation, Location} from './sourceLocation'; import CidAssigner from '....
amorimjuliana/sdk-js
src/schema/userSchema.ts
import StringType from '../validation/stringType'; import ObjectType from '../validation/objectType'; import UnionType from '../validation/unionType'; import BooleanType from '../validation/booleanType'; import NullType from '../validation/nullType'; import NumberType from '../validation/numberType'; import ArrayType f...
amorimjuliana/sdk-js
src/retry/maxAttemptsPolicy.ts
<reponame>amorimjuliana/sdk-js import {RetryPolicy} from './index'; export default class MaxAttemptsPolicy<T> implements RetryPolicy<T> { private readonly maxAttempts: number; private readonly delay: number; public constructor(delay: number, maxAttempts: number) { if (delay < 0) { thr...
amorimjuliana/sdk-js
src/tracker.ts
import {Logger} from './logging'; import Tab, {TabEvent, TabUrlChangeEvent, TabVisibilityChangeEvent} from './tab'; import {OutputChannel} from './channel'; import NullLogger from './logging/nullLogger'; import {formatCause} from './error'; import { Beacon, BeaconPayload, TrackingEvent, TrackingEventCon...
amorimjuliana/sdk-js
src/logging/index.ts
<filename>src/logging/index.ts export interface Logger { debug(message: string): void; info(message: string): void; warn(message: string): void; error(message: string): void; } export interface LoggerFactory { (namespace?: string): Logger; }
amorimjuliana/sdk-js
test/validation/stringType.test.ts
<filename>test/validation/stringType.test.ts import StringType from '../../src/validation/stringType'; describe('A string type', () => { test('should provide the allowed type', () => { expect(new StringType().getTypes()).toEqual(['string']); }); test.each([ [null, false], ['foo', t...
amorimjuliana/sdk-js
test/schemas/ecommerceSchemas.test.ts
import {Cart, CartItem, Order, OrderItem, ProductDetails} from '../../src/trackingEvents'; import {cart, cartItem, order, orderItem, productDetails} from '../../src/schema/ecommerceSchemas'; import {Optional} from '../../src/utilityTypes'; const minimalProductDetails: ProductDetails = { productId: '12345', nam...
amorimjuliana/sdk-js
test/schemas/eventSchemas.test.ts
import {Cart, CartItem, Order, OrderItem, ProductDetails} from '../../src/trackingEvents'; import { cartViewed, cartModified, checkoutStarted, orderPlaced, productViewed, userSignedUp, testGroupAssigned, eventOccurred, goalCompleted, } from '../../src/schema/eventSchemas'; import {Op...
amorimjuliana/sdk-js
test/facade/trackerFacade.test.ts
import Tracker from '../../src/tracker'; import TrackerFacade from '../../src/facade/trackerFacade'; import { ExternalTrackingEvent as ExternalEvent, ExternalTrackingEventPayload as ExternalEventPayload, ExternalTrackingEventType as ExternalEventType, } from '../../src/trackingEvents'; describe('A tracker ...
amorimjuliana/sdk-js
test/token/index.test.ts
import Token, {FixedTokenProvider} from '../../src/token'; import {base64UrlEncode} from '../../src/base64Url'; describe('A token', () => { const appId = '7e9d59a9-e4b3-45d4-b1c7-48287f1e5e8a'; const anonymousSerializedToken = '<KEY> + <KEY>' + <KEY> test('may contain headers', () => { ...
amorimjuliana/sdk-js
src/retry/arbitraryPolicy.ts
<reponame>amorimjuliana/sdk-js import {RetryPolicy} from './index'; export default class ArbitraryPolicy<T> implements RetryPolicy<T> { private readonly delays: number[]; public constructor(delays: number[]) { if (delays.length < 1) { throw new Error('The list of delays cannot be empty.');...
amorimjuliana/sdk-js
src/queue/inMemoryQueue.ts
import {Queue} from './index'; export default class InMemoryQueue<T> implements Queue<T> { private queue: T[] = []; public constructor(...values: T[]) { this.queue.unshift(...values); } public all(): T[] { return this.queue.slice(); } public getCapacity(): number { re...
amorimjuliana/sdk-js
test/channel/guaranteedChannel.test.ts
<reponame>amorimjuliana/sdk-js import {Envelope, GuaranteedChannel, MessageStamper, TimeStamper} from '../../src/channel/guaranteedChannel'; import SandboxChannel from '../../src/channel/sandboxChannel'; describe('A guaranteed channel', () => { let stamper: MessageStamper<string, string>; let sandboxChannel: S...
amorimjuliana/sdk-js
src/sourceLocation.ts
export type Position = { line: number, column: number, index: number, }; export type Location = { start: Position, end: Position, }; export function getLength(input: string): number { return [...input].length; } export function getPosition(input: string, index: number): Position { return ...
amorimjuliana/sdk-js
test/schemas/evaluationSchemas.test.ts
<filename>test/schemas/evaluationSchemas.test.ts import {optionsSchema} from '../../src/schema/evaluationSchemas'; describe('The evaluation option schema', () => { test.each([ [{}], [{ timeout: 1, }], [{ attributes: {foo: 'bar'}, }], [{ ...
amorimjuliana/sdk-js
test/schemas/sdkSchemas.test.ts
<filename>test/schemas/sdkSchemas.test.ts import {configurationSchema, eventMetadataSchema} from '../../src/schema/sdkSchemas'; describe('The event metadata schema', () => { test.each([ [{}], [{ foo: 'bar', _keyWith20Characters: 'x'.repeat(300), thirdKey: 'someVa...
amorimjuliana/sdk-js
src/schema/tokenSchema.ts
import ObjectType from '../validation/objectType'; import StringType from '../validation/stringType'; import NumberType from '../validation/numberType'; export default new ObjectType({ required: ['headers', 'claims'], properties: { headers: new ObjectType({ required: ['typ', 'alg', 'appId']...
amorimjuliana/sdk-js
test/utils/dumbStorage.ts
export class DumbStorage implements Storage { private store: {[key: string]: string} = {}; private readonly invalidJson: boolean = false; public constructor(returnInvalidJson = false) { this.invalidJson = returnInvalidJson; } public clear(): void { this.store = {}; } publ...
amorimjuliana/sdk-js
src/validation/jsonType.ts
import {describe, formatPath, Schema, TypeSchema, Violation} from './index'; import {JsonArray, JsonObject, JsonPrimitive, JsonValue} from '../json'; function isJsonPrimitive(value: unknown): value is JsonPrimitive { return value === null || typeof value === 'string' || typeof value === 'boolean' || typeof value =...
amorimjuliana/sdk-js
src/facade/userFacade.ts
import Tracker from '../tracker'; import UserPatch from './userPatch'; import Context from '../context'; export default class UserFacade { private readonly context: Context; private readonly tracker: Tracker; public constructor(context: Context, tracker: Tracker) { this.context = context; ...
amorimjuliana/sdk-js
test/facade/sessionFacade.test.ts
<reponame>amorimjuliana/sdk-js<filename>test/facade/sessionFacade.test.ts import Tracker from '../../src/tracker'; import SessionFacade from '../../src/facade/sessionFacade'; import {SessionAttributesChanged} from '../../src/trackingEvents'; describe('A session facade', () => { let tracker: Tracker; let sessio...
amorimjuliana/sdk-js
src/schema/ecommerceSchemas.ts
import ObjectType from '../validation/objectType'; import StringType from '../validation/stringType'; import NumberType from '../validation/numberType'; import ArrayType from '../validation/arrayType'; export const productDetails = new ObjectType({ required: ['productId', 'name', 'displayPrice'], properties: {...
amorimjuliana/sdk-js
src/transformer.ts
<reponame>amorimjuliana/sdk-js<gh_stars>10-100 export interface Transformer<I, O> { (input: I): Promise<O>; } export const encodeJson: Transformer<any, string> = function encodeJson(input: any): Promise<string> { return Promise.resolve(JSON.stringify(input)); };
amorimjuliana/sdk-js
src/base64Url.ts
function base64Unescape(value: string): string { return (value + '==='.slice((value.length + 3) % 4)).replace(/-/g, '+').replace(/_/g, '/'); } function base64Escape(value: string): string { return value .replace(/\+/g, '-') .replace(/\//g, '_') .replace(/=/g, ''); } export function bas...
amorimjuliana/sdk-js
src/token/replicatedTokenStore.ts
import Token, {TokenStore} from './index'; export default class ReplicatedTokenStore implements TokenStore { private primary: TokenStore; private secondary: TokenStore; public constructor(primary: TokenStore, secondary: TokenStore) { this.primary = primary; this.secondary = secondary; ...
amorimjuliana/sdk-js
src/token/index.ts
import {base64UrlDecode, base64UrlEncode} from '../base64Url'; import tokenSchema from '../schema/tokenSchema'; import {formatCause} from '../error'; export type Headers = { typ: string, alg: string, kid?: string, appId: string, }; export type Claims = { iss: string, aud: string, iat: numb...
amorimjuliana/sdk-js
test/queue/inMemoryQueue.test.ts
import InMemoryQueue from '../../src/queue/inMemoryQueue'; describe('An in-memory queue', () => { let queue: InMemoryQueue<string>; beforeEach(() => { queue = new InMemoryQueue(); }); test('should provide all items', () => { queue.push('foo'); queue.push('bar'); expec...
amorimjuliana/sdk-js
test/channel/queuedChannel.test.ts
<filename>test/channel/queuedChannel.test.ts<gh_stars>0 import InMemoryQueue from '../../src/queue/inMemoryQueue'; import QueuedChannel from '../../src/channel/queuedChannel'; import {OutputChannel} from '../../src/channel'; import CapacityRestrictedQueue from '../../src/queue/capacityRestrictedQueue'; describe('A que...
amorimjuliana/sdk-js
src/schema/loggerSchema.ts
import ObjectType from '../validation/objectType'; import FunctionType from '../validation/functionType'; export const loggerSchema = new ObjectType({ required: ['debug', 'info', 'warn', 'error'], additionalProperties: true, properties: { debug: new FunctionType(), info: new FunctionType(),...
amorimjuliana/sdk-js
test/channel/retryChannel.test.ts
<reponame>amorimjuliana/sdk-js<filename>test/channel/retryChannel.test.ts import RetryChannel from '../../src/channel/retryChannel'; import {OutputChannel} from '../../src/channel'; import MaxAttemptsPolicy from '../../src/retry/maxAttemptsPolicy'; describe('A retry channel', () => { afterEach(() => { jest...
amorimjuliana/sdk-js
src/cid/remoteAssigner.ts
<filename>src/cid/remoteAssigner.ts import {Logger} from '../logging/index'; import NullLogger from '../logging/nullLogger'; import {formatCause} from '../error'; import CidAssigner from './index'; export default class RemoteAssigner implements CidAssigner { private readonly logger: Logger; private readonly e...
amorimjuliana/sdk-js
test/schemas/loggerSchema.test.ts
import {loggerSchema} from '../../src/schema/loggerSchema'; describe('The logger schema', () => { test('should allow valid loggers', () => { const logger = { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn(), extra: true, ...
amorimjuliana/sdk-js
src/cid/index.ts
<reponame>amorimjuliana/sdk-js export default interface CidAssigner { assignCid(): Promise<string>; }
amorimjuliana/sdk-js
test/container.test.ts
import WS from 'jest-websocket-mock'; import * as fetchMock from 'fetch-mock'; import {Configuration, Container} from '../src/container'; import NullLogger from '../src/logging/nullLogger'; import {Logger} from '../src/logging'; import {BeaconPayload} from '../src/trackingEvents'; import LocalStorageCache from '../src/...
amorimjuliana/sdk-js
src/validation/index.ts
<gh_stars>0 export function formatPath(path: string[]): string { return `/${path.join('/')}`; } export function describe(value: unknown): string { if (value === null) { return 'null'; } if (Array.isArray(value)) { return 'array'; } if (typeof value === 'number') { retu...
amorimjuliana/sdk-js
test/uuid.test.ts
import {uuid4} from '../src/uuid'; afterEach(() => { jest.restoreAllMocks(); }); describe('A UUID v4 function', () => { test('should generate a random UUID', () => { const generated = []; for (let iteration = 0; iteration < 100; iteration++) { const uuid = uuid4(); ex...
amorimjuliana/sdk-js
src/logging/nullLogger.ts
import {Logger} from './index'; export default class NullLogger implements Logger { public debug(): void { // suppress debug logs } public info(): void { // suppress info logs } public warn(): void { // suppress warning logs } public error(): void { // sup...
amorimjuliana/sdk-js
src/channel/guaranteedChannel.ts
import {Logger} from '../logging'; import {DuplexChannel, OutputChannel} from './index'; import NullLogger from '../logging/nullLogger'; export type MessageStamper<M, S> = { generate(message: M): S, }; export class TimeStamper implements MessageStamper<any, string> { public generate(): string { return...
amorimjuliana/sdk-js
test/sourceLocation.test.ts
import {getLength, getLocation, getPosition} from '../src/sourceLocation'; describe('The string length function', () => { test.each([ ['What if\nwe could\ndo this?', 25], ['What if\r\nwe could\r\ndo this?', 27], ['foo', 3], ['🐊', 1], ['I 💚 🐊', 5], ['', 0], ])(...
amorimjuliana/sdk-js
test/queue/persistentQueue.test.ts
<reponame>amorimjuliana/sdk-js import PersistentQueue from '../../src/queue/persistentQueue'; import {DumbStorage} from '../utils/dumbStorage'; describe('A persistent queue', () => { test('should provide all items', () => { const queue = new PersistentQueue<string>(new DumbStorage()); queue.push('...
amorimjuliana/sdk-js
src/channel/beaconSocketChannel.ts
<reponame>amorimjuliana/sdk-js<gh_stars>0 import {ChannelListener, DuplexChannel} from './index'; import {Envelope} from './guaranteedChannel'; import {Logger, LoggerFactory} from '../logging'; import NullLogger from '../logging/nullLogger'; import CidAssigner from '../cid'; export interface DuplexChannelFactory { ...
amorimjuliana/sdk-js
test/logging/nullLogger.test.ts
import NullLogger from '../../src/logging/nullLogger'; describe('A null logger', () => { afterEach(() => { jest.clearAllMocks(); }); test('should not log info messages', () => { const info = jest.spyOn(window.console, 'info'); const logger = new NullLogger(); logger.info(...
amorimjuliana/sdk-js
src/schema/eventSchemas.ts
import ObjectType from '../validation/objectType'; import StringType from '../validation/stringType'; import {cart, order, productDetails} from './ecommerceSchemas'; import {userProfileSchema} from './userSchema'; import NumberType from '../validation/numberType'; import UnionType from '../validation/unionType'; import...
amorimjuliana/sdk-js
test/context.test.ts
<filename>test/context.test.ts import Context, {TokenScope} from '../src/context'; import Token from '../src/token'; import TabEventEmulator from './utils/tabEventEmulator'; import LocalStorageCache from '../src/cache/localStorageCache'; import {DumbStorage} from './utils/dumbStorage'; import {EventDispatcher} from '.....
amorimjuliana/sdk-js
test/validation/arrayType.test.ts
import ArrayType from '../../src/validation/arrayType'; import NumberType from '../../src/validation/numberType'; describe('An array type', () => { test('should provide the allowed type', () => { expect(new ArrayType().getTypes()).toEqual(['array']); }); test.each([ [null, false], ...
amorimjuliana/sdk-js
src/validation/nullType.ts
<filename>src/validation/nullType.ts import {describe, formatPath, TypeSchema, Violation} from './index'; export default class NullType implements TypeSchema { public getTypes(): string[] { return ['null']; } public isValidType(value: unknown): value is null { return value === null; } ...
amorimjuliana/sdk-js
test/cid/fixedCidAssigner.test.ts
<gh_stars>0 import FixedCidAssigner from '../../src/cid/fixedCidAssigner'; describe('A fixed CID assigner', () => { test('should always provide the same CID', async () => { const assigner = new FixedCidAssigner('123'); await expect(assigner.assignCid()).resolves.toEqual('123'); await expec...
amorimjuliana/sdk-js
src/facade/sdkFacade.ts
<filename>src/facade/sdkFacade.ts import EvaluatorFacade, {TabContextFactory} from './evaluatorFacade'; import TrackerFacade from './trackerFacade'; import Context, {TokenScope} from '../context'; import UserFacade from './userFacade'; import Token from '../token'; import {formatCause} from '../error'; import {configur...
amorimjuliana/sdk-js
src/validation/stringType.ts
<reponame>amorimjuliana/sdk-js import {describe, formatPath, TypeSchema, Violation} from './index'; interface Format { (value: string): boolean; } const FORMAT: {[key: string]: Format} = { pointer: function identifier(value: string): boolean { return /^(\.|([a-zA-Z_][a-zA-Z0-9_]*|\[[0-9]+])(\.[a-zA-Z_...
amorimjuliana/sdk-js
src/logging/namespacedLogger.ts
<gh_stars>0 import {Logger} from './index'; export default class NamespacedLogger implements Logger { private readonly logger: Logger; private readonly namespace: string; public constructor(logger: Logger, namespace: string) { this.logger = logger; this.namespace = namespace; } p...
amorimjuliana/sdk-js
src/cache/localStorageCache.ts
import {CacheListener, ObservableCache} from './index'; export default class LocalStorageCache implements ObservableCache { private readonly storage: Storage; private readonly key: string; private value: string|null; private readonly listeners: CacheListener[] = []; public constructor(storage: ...
amorimjuliana/sdk-js
src/eventManager.ts
export interface EventListener<T> { (event: T): void; } export type EventMap = Record<string, object>; export interface EventDispatcher<TEvents extends EventMap> { dispatch<T extends keyof TEvents>(eventName: T, event: TEvents[T]): void; } export interface EventSubscriber<TEvents extends EventMap> { addL...
amorimjuliana/sdk-js
test/evaluator.test.ts
import * as fetchMock from 'fetch-mock'; import {MockOptions} from 'fetch-mock'; import Evaluator, { ErrorResponse, EvaluationContext, EvaluationError, EvaluationErrorType, ExpressionError, ExpressionErrorResponse, } from '../src/evaluator'; import Token, {FixedTokenProvider} from '../src/token'...
amorimjuliana/sdk-js
test/retry/maxAttemptsPolicy.test.ts
import MaxAttemptsPolicy from '../../src/retry/maxAttemptsPolicy'; describe('A max-attempts policy', () => { test('should ensure the delay is non-negative', () => { function invalidPolicy(): MaxAttemptsPolicy<any> { return new MaxAttemptsPolicy(-1, 1); } expect(invalidPolicy).t...
amorimjuliana/sdk-js
src/utilityTypes.ts
<gh_stars>10-100 export type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never; export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
amorimjuliana/sdk-js
test/validation/jsonType.test.ts
<reponame>amorimjuliana/sdk-js import {JsonArrayType, JsonObjectType, JsonPrimitiveType, JsonType} from '../../src/validation/jsonType'; describe('A JSON array type', () => { test('should the allowed type', () => { expect(new JsonArrayType().getTypes()).toEqual(['array']); }); test.each([ ...
amorimjuliana/sdk-js
src/sdkEvents.ts
<gh_stars>0 import Token from './token/index'; export interface TokenChanged { oldToken: Token|null; newToken: Token|null; } export type SdkEventMap = Record<string, object> & { tokenChanged: TokenChanged, }; export type SdkEventType = keyof SdkEventMap; export type SdkEvent<T extends SdkEventType = Sdk...
amorimjuliana/sdk-js
src/index.ts
import {VERSION} from './constants'; import Sdk, {Configuration} from './sdk'; export {Sdk as default, Configuration, VERSION};
amorimjuliana/sdk-js
src/queue/index.ts
<reponame>amorimjuliana/sdk-js export interface Queue<T> { getCapacity(): number; all(): T[]; push(value: T): void; shift(): T; peek(): T | null; isEmpty(): boolean; length(): number; }
amorimjuliana/sdk-js
src/queue/persistentQueue.ts
<gh_stars>0 import {Queue} from './index'; export default class PersistentQueue<T> implements Queue<T> { private cache: T[]; private readonly storage: Storage; private readonly key: string; public constructor(storage: Storage, key = 'queue') { this.storage = storage; this.key = key; ...
amorimjuliana/sdk-js
test/validation/index.test.ts
<gh_stars>0 import {describe as describeValue, formatPath, Violation} from '../../src/validation'; class SomeClass {} describe('A validation', () => { test('should provide a function for formatting paths', () => { expect(formatPath(['foo', 'bar', 'baz'])).toEqual('/foo/bar/baz'); }); test.each([ ...
amorimjuliana/sdk-js
test/validation/functionType.test.ts
import FunctionType from '../../src/validation/functionType'; describe('A function type', () => { test('should provide the allowed type', () => { expect(new FunctionType().getTypes()).toEqual(['function']); }); test.each([ [(): void => {}, true], [jest.fn(), true], [1, fals...
amorimjuliana/sdk-js
src/sdk.ts
import {Container} from './container'; import Context, {TokenScope} from './context'; import {Logger} from './logging'; import {BOOTSTRAP_ENDPOINT_URL, EVALUATION_ENDPOINT_URL, TRACKER_ENDPOINT_URL, VERSION} from './constants'; import {configurationSchema} from './schema/sdkSchemas'; import {formatCause} from './error'...
amorimjuliana/sdk-js
src/facade/trackerFacade.ts
import { ExternalTrackingEvent as ExternalEvent, ExternalTrackingEventPayload as ExternalEventPayload, ExternalTrackingEventType as ExternalEventType, } from '../trackingEvents'; import {formatCause} from '../error'; import Tracker, {EventListener} from '../tracker'; import { cartModified, cartViewe...
amorimjuliana/sdk-js
test/token/replicatedStorage.test.ts
<filename>test/token/replicatedStorage.test.ts import Token from '../../src/token'; import ReplicatedTokenStore from '../../src/token/replicatedTokenStore'; import InMemoryTokenStore from '../../src/token/inMemoryTokenStore'; describe('A replicated token store', () => { const token = Token.issue('<PASSWORD>', '<PA...
amorimjuliana/sdk-js
src/cache/index.ts
export default interface Cache { get(): string|null; put(value: string): void; clear(): void; } export interface CacheListener { (value: string|null): void; } export interface ObservableCache extends Cache { addListener(listener: CacheListener): void; removeListener(listener: CacheListener): ...
amorimjuliana/sdk-js
test/error.test.ts
<reponame>amorimjuliana/sdk-js<gh_stars>10-100 import {formatCause, formatMessage} from '../src/error'; describe('A error formatter', () => { test.each([ [new Error('Error message.'), 'Error message.'], [new Error(''), ''], ['foo', 'Foo'], ['', 'Unknown error'], [null, 'Unkn...
amorimjuliana/sdk-js
src/json.ts
<reponame>amorimjuliana/sdk-js export type JsonPrimitive = string | number | boolean | null; export type JsonObject = { [member: string]: JsonValue }; export type JsonArray = Array<JsonValue>; export type JsonValue = JsonPrimitive | JsonObject | JsonArray; export type LenientJsonObject = { [member: string]: Lenient...
amorimjuliana/sdk-js
test/cid/remoteCidAssigner.test.ts
<reponame>amorimjuliana/sdk-js import * as fetchMock from 'fetch-mock'; import {MockOptions} from 'fetch-mock'; import RemoteAssigner from '../../src/cid/remoteAssigner'; describe('A remote CID assigner', () => { const ENDPOINT = 'https://localhost:8080/endpoint'; const requestMatcher: MockOptions = { ...
amorimjuliana/sdk-js
src/cid/fixedCidAssigner.ts
<gh_stars>0 import CidAssigner from './index'; export default class FixedCidAssigner implements CidAssigner { private readonly cid: string; public constructor(cid: string) { this.cid = cid; } public assignCid(): Promise<string> { return Promise.resolve(this.cid); } }
amorimjuliana/sdk-js
test/facade/evaluatorFacade.test.ts
<gh_stars>0 import EvaluatorFacade, {MinimalContextFactory, TabContextFactory} from '../../src/facade/evaluatorFacade'; import Evaluator, {Campaign, EvaluationOptions, Page} from '../../src/evaluator'; import Tab from '../../src/tab'; import {JsonObject} from '../../src/json'; const timezone = Intl.DateTimeFormat().re...
amorimjuliana/sdk-js
test/logging/consoleLogger.test.ts
<gh_stars>0 import ConsoleLogger from '../../src/logging/consoleLogger'; describe('A console logger', () => { afterEach(() => { jest.clearAllMocks(); }); test('should log debug messages to the console', () => { const consoleDebug = jest.spyOn(window.console, 'debug').mockImplementation(); ...
amorimjuliana/sdk-js
src/schema/operationSchemas.ts
import ObjectType from '../validation/objectType'; import StringType from '../validation/stringType'; import NumberType from '../validation/numberType'; import {JsonArrayType, JsonObjectType, JsonPrimitiveType} from '../validation/jsonType'; import UnionType from '../validation/unionType'; const pointer = new StringTy...
amorimjuliana/sdk-js
test/activeRecord.test.ts
import ActiveRecord from '../src/activeRecord'; import {Patch} from '../src/patch'; class TestRecord extends ActiveRecord<any> { public save(): Promise<any> { return Promise.resolve(this); } public reset(): this { return super.reset(); } public buildPatch(): Patch { return...
amorimjuliana/sdk-js
test/base64Url.test.ts
import {base64UrlDecode, base64UrlEncode} from '../src/base64Url'; describe('A base64 URL encoder/decoder function', () => { const encodeTests = [ ['000000', 'MDAwMDAw'], ['\0\0\0\0', 'AAAAAA'], ['\xff', '_w'], ['\xff\xff', '__8'], ['\xff\xff\xff', '____'], ['\xff\xf...
amorimjuliana/sdk-js
src/cid/cachedAssigner.ts
import {Logger} from '../logging/index'; import NullLogger from '../logging/nullLogger'; import CidCache from '../cache'; import CidAssigner from './index'; export default class CachedAssigner implements CidAssigner { private readonly assigner: CidAssigner; private readonly cache: CidCache; private reado...
amorimjuliana/sdk-js
test/validation/numberType.test.ts
import NumberType from '../../src/validation/numberType'; describe('A number type', () => { test('should provide the allowed type', () => { expect(new NumberType({}).getTypes()).toEqual(['number']); }); test.each([ [null, false], ['foo', false], [true, false], [1, t...
amorimjuliana/sdk-js
src/retry/index.ts
<gh_stars>10-100 export interface RetryPolicy<T> { shouldRetry(attempt: number, subject?: T, failure?: any): boolean; getDelay(attempt: number): number; }
amorimjuliana/sdk-js
src/constants.ts
<reponame>amorimjuliana/sdk-js export const TRACKER_ENDPOINT_URL = '<@trackerEndpointUrl@>'; export const EVALUATION_ENDPOINT_URL = '<@evaluationEndpointUrl@>'; export const BOOTSTRAP_ENDPOINT_URL = '<@bootstrapEndpointUrl@>'; export const MAX_EXPRESSION_LENGTH = parseInt('<@maxExpressionLength@>', 10); export const VE...
amorimjuliana/sdk-js
test/channel/encodedChannel.test.ts
<gh_stars>0 import EncodedChannel from '../../src/channel/encodedChannel'; import {OutputChannel} from '../../src/channel'; describe('An encoded channel', () => { let outputChannel: OutputChannel<string>; let channel: EncodedChannel<string, string>; beforeEach(() => { outputChannel = { ...
amorimjuliana/sdk-js
test/retry/neverPolicy.test.ts
import NeverPolicy from '../../src/retry/neverPolicy'; describe('A never policy', () => { test('should impose an infinity delay', () => { const policy = new NeverPolicy(); expect(policy.getDelay()).toBe(Infinity); }); test('should never retry', () => { const policy = new NeverPoli...
amorimjuliana/sdk-js
src/channel/sandboxChannel.ts
import {ChannelListener, DuplexChannel} from './index'; export default class SandboxChannel<I, O> implements DuplexChannel<I, O> { private readonly listeners: ChannelListener<I>[] = []; public readonly messages: O[] = []; private closed = false; public publish(message: O): Promise<void> { th...
amorimjuliana/sdk-js
src/validation/unionType.ts
<reponame>amorimjuliana/sdk-js<filename>src/validation/unionType.ts import {describe, formatPath, TypeSchema, Violation} from './index'; export default class UnionType implements TypeSchema { private readonly schemas: TypeSchema[]; public constructor(first: TypeSchema, second: TypeSchema, ...others: TypeSchem...
amorimjuliana/sdk-js
src/facade/sessionPatch.ts
import ActiveRecord from '../activeRecord'; import Tracker from '../tracker'; import {SessionAttributesChanged} from '../trackingEvents'; export default class SessionPatch extends ActiveRecord<SessionAttributesChanged> { private readonly tracker: Tracker; public constructor(tracker: Tracker) { super()...
amorimjuliana/sdk-js
src/activeRecord.ts
<filename>src/activeRecord.ts import {Operation, Patch} from './patch'; import {JsonArray, JsonObject, JsonValue} from './json'; import {TrackingEvent} from './trackingEvents'; import { addOperation, clearOperation, combineOperation, decrementOperation, incrementOperation, mergeOperation, se...
amorimjuliana/sdk-js
src/schema/contextSchemas.ts
import StringType from '../validation/stringType'; export const tokenScopeSchema = new StringType({ enumeration: ['global', 'contextual', 'isolated'], });
amorimjuliana/sdk-js
src/token/inMemoryTokenStore.ts
<filename>src/token/inMemoryTokenStore.ts import Token, {TokenStore} from './index'; export default class InMemoryTokenStore implements TokenStore { private token: Token | null = null; public getToken(): Token | null { return this.token; } public setToken(token: Token | null): void { ...
amorimjuliana/sdk-js
test/facade/userFacade.test.ts
<filename>test/facade/userFacade.test.ts import Tracker from '../../src/tracker'; import UserFacade from '../../src/facade/userFacade'; import {UserProfileChanged} from '../../src/trackingEvents'; import Context from '../../src/context'; describe('A user facade', () => { const {default: ContextMock} = jest.genMock...
jtmthf/jack-moore
src/result-types.ts
<filename>src/result-types.ts /* tslint:disable */ // This file was automatically generated and should not be edited. export interface SiteTitleQueryQuery { site: { siteMetadata: { title: string | null, } | null, } | null, };
jtmthf/jack-moore
src/pages/index.tsx
import React from 'react'; const IndexPage = () => ( <div> <h1>Hi I'm Jack</h1> <h2>I'm a full-stack web developer based out of Kansas City.</h2> </div> ); export default IndexPage;
jtmthf/jack-moore
src/types.ts
<filename>src/types.ts declare function graphql(template: TemplateStringsArray): any;
jtmthf/jack-moore
src/layouts/index.tsx
import React, { SFC } from 'react'; import Helmet from 'react-helmet'; import Header from '../components/header'; import { SiteTitleQueryQuery } from '../result-types'; import './index.css'; type Props = { children(): JSX.Element; data: SiteTitleQueryQuery; }; const Layout: SFC<Props> = ({ children, data }) => (...
nsected/simple-crawler-frontend
client/imports/app/sites/sites-data.service.ts
import { Injectable } from "@angular/core"; import { ObservableCursor } from "meteor-rxjs"; import { Sites } from "../../../../both/models/sites.model"; import { SitesCollection } from "../../../../both/collections/sites.collection"; @Injectable() export class SitesDataService { private data: ObservableCursor<Sites>...
nsected/simple-crawler-frontend
both/models/site.model.ts
import {Sites} from "./sites.model"; import {ObservableCursor} from "meteor-rxjs"; export interface Site { site?: ObservableCursor<Sites>; err?: Error }
nsected/simple-crawler-frontend
client/imports/app/results_table/results_table.component.ts
<gh_stars>0 import {Component, Input, OnInit} from "@angular/core"; import template from "./results_table.component.html"; import style from "./results_table.component.scss"; import {ResultsTableDataService} from "./results_table_data.service"; import {BehaviorSubject} from "rxjs/BehaviorSubject"; import {Subject} from...
nsected/simple-crawler-frontend
client/imports/app/sites/sites.component.ts
<gh_stars>0 import { Component, OnInit } from "@angular/core"; import { Observable } from "rxjs"; import { SitesDataService } from "./sites-data.service"; import { Sites } from "../../../../both/models/sites.model"; import template from "./sites.component.html"; import style from "./sites.component.scss"; import {Sites...
nsected/simple-crawler-frontend
client/imports/app/app-routing.module.ts
<gh_stars>0 import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { SitesComponent } from "./sites/sites.component"; import { NotFoundComponent } from "./not_found/not_found.component"; import { SiteItemComponent } from "./site_item/site_item.component"; im...
nsected/simple-crawler-frontend
client/imports/app/add_site/add_site_data_service.ts
<reponame>nsected/simple-crawler-frontend import {Injectable} from "@angular/core"; import {ObservableCursor} from "meteor-rxjs"; import {SitesCollection} from "../../../../both/collections/sites.collection"; import {MongoObservable} from "meteor-rxjs"; import {Site} from "../../../../both/models/site.model"; @Injecta...
nsected/simple-crawler-frontend
both/models/page.model.ts
<reponame>nsected/simple-crawler-frontend<filename>both/models/page.model.ts export interface Page { contentType: "string", url: "string", redirectURL: "string", create_date: "date", update_date: "date", status: "Number", bodySize: "Number", site: "string", }
nsected/simple-crawler-frontend
both/collections/sites.collection.ts
import { MongoObservable } from "meteor-rxjs"; import {Sites} from "../models/sites.model"; export const SitesCollection = new MongoObservable.Collection<Sites>("sites", { idGeneration: 'MONGO' }); if (Meteor.isServer) { Meteor.publish('sites', function(){ return SitesCollection.find(); }); } if (Met...