Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hypertune

Package Overview
Dependencies
Maintainers
2
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hypertune - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

dist/lib/merge.d.ts

10

CHANGELOG.md
# Changelog
## 2.1.2
- You can now use the `merge` helper function to recursively merge objects.
## 2.1.1

@@ -14,7 +18,9 @@

## 2.0.2
- Vercel edge config initialization improvements.
- Vercel Edge Config initialization improvements.
## 2.0.1
- Fix excessive logging.
- Less verbose logging.
## 2.0.0

@@ -21,0 +27,0 @@

3

dist/index.d.ts

@@ -5,2 +5,3 @@ import "regenerator-runtime/runtime";

import Node from "./lib/Node";
import merge from "./lib/merge";
import HypertuneEdgeInitDataProvider from "./lib/initDataProviders/HypertuneEdgeInitDataProvider";

@@ -12,3 +13,3 @@ import VercelEdgeConfigInitDataProvider from "./lib/initDataProviders/VercelEdgeConfigInitDataProvider";

*/
CreateOptions as InitOptions, DehydratedState, DeepPartial, };
CreateOptions as InitOptions, DehydratedState, DeepPartial, merge, };
export { LogLevel } from "./shared/types";

@@ -15,0 +16,0 @@ export { create,

@@ -22,3 +22,3 @@ import { InitData, Expression, Query, Value, ObjectValueWithVariables, UpdateListener, ReductionLogs, DehydratedState, DeepPartial, InitDataProvider, ObjectValue } from "../shared";

}> | null;
override: object | null;
override: DeepPartial<ObjectValue> | null;
constructor({ initData, initDataProvider, initIntervalMs, query, queryCode, variableValues, logger, loggerFlushIntervalMs, cacheSize, override, }: {

@@ -47,5 +47,5 @@ initData: InitData | null;

private notifyUpdateListeners;
setOverride<TOverride extends object>(traceId: string, override: DeepPartial<TOverride> | null): void;
setOverride<TOverride extends ObjectValue>(traceId: string, override: DeepPartial<TOverride> | null): void;
dehydrate<TOverride extends object, TVariableValues extends ObjectValue>(query?: Query<ObjectValueWithVariables>, variableValues?: TVariableValues): DehydratedState<TOverride, TVariableValues> | null;
hydrate<TOverride extends object, TVariableValues extends ObjectValue>(traceId: string, dehydratedState: DehydratedState<TOverride, TVariableValues>): void;
hydrate<TOverride extends ObjectValue, TVariableValues extends ObjectValue>(traceId: string, dehydratedState: DehydratedState<TOverride, TVariableValues>): void;
reduce(query: Query<ObjectValueWithVariables> | null, expression: Expression): Expression;

@@ -52,0 +52,0 @@ private log;

@@ -46,3 +46,3 @@ import { Expression, ObjectValue, Query, Step, Value, UpdateListener, ReductionLogs, DehydratedState, DeepPartial, ObjectValueWithVariables } from "../shared";

flushLogs(traceId?: string): Promise<void>;
setOverride<T extends object>(override: DeepPartial<T>, traceId?: string): void;
setOverride<T extends ObjectValue>(override: DeepPartial<T>, traceId?: string): void;
dehydrate<TOverride extends object, TVariableValues extends ObjectValue>(query?: Query<ObjectValueWithVariables>, variableValues?: TVariableValues): DehydratedState<TOverride, TVariableValues> | null;

@@ -49,0 +49,0 @@ hydrate<TOverride extends object, TVariableValues extends ObjectValue>(dehydratedState: DehydratedState<TOverride, TVariableValues>, traceId?: string): void;

@@ -9,3 +9,3 @@ "use strict";

const getMetadata_1 = __importDefault(require("../shared/helpers/getMetadata"));
const mergeValueAndOverride_1 = __importDefault(require("../shared/helpers/mergeValueAndOverride"));
const merge_1 = __importDefault(require("./merge"));
const throwIfObjectValueIsInvalid_1 = __importDefault(require("../shared/helpers/throwIfObjectValueIsInvalid"));

@@ -169,3 +169,3 @@ const getLocalLogArguments_1 = __importDefault(require("./getLocalLogArguments"));

const { value: valueWithoutOverride, logs: reductionLogs } = valueAndLogs;
const value = (0, mergeValueAndOverride_1.default)(valueWithoutOverride, this.getNodeOverride());
const value = (0, merge_1.default)(valueWithoutOverride, this.getNodeOverride());
this.log(shared_1.LogLevel.Debug, `Evaluated to ${JSON.stringify(value)}`,

@@ -179,23 +179,23 @@ /* metadata */ { query }, reductionLogs);

if (!context) {
return null;
return undefined;
}
if (context.override === null || context.override === undefined) {
// Short-circuit if no override in context
return null;
return undefined;
}
if (!parent) {
// We're the Query node
return (_a = context.override) !== null && _a !== void 0 ? _a : null;
return (_a = context.override) !== null && _a !== void 0 ? _a : undefined;
}
if (!step) {
return null;
return undefined;
}
const parentOverride = parent.getNodeOverride();
if (parentOverride === null || parentOverride === undefined) {
return null;
return undefined;
}
if (step.type === "GetFieldStep") {
return (_b = parentOverride[step.fieldName]) !== null && _b !== void 0 ? _b : null;
return (_b = parentOverride[step.fieldName]) !== null && _b !== void 0 ? _b : undefined;
}
return (_c = parentOverride[step.index]) !== null && _c !== void 0 ? _c : null;
return (_c = parentOverride[step.index]) !== null && _c !== void 0 ? _c : undefined;
}

@@ -202,0 +202,0 @@ // @internal

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** Replaced by the value in package.json on build */
exports.default = "2.1.1";
exports.default = "2.1.2";
//# sourceMappingURL=sdkVersion.js.map

@@ -331,2 +331,4 @@ import { isQueryVariableKey } from "./constants";

name: string;
description?: string;
archived?: boolean;
dimensions: {

@@ -560,12 +562,11 @@ [dimensionId: string]: Dimension;

/**
* CreateOptions contains all statically typed options that are used to create
* hypertune source. Options that rely on types in generated code are defined
* there instead.
* CreateOptions contains options used to create the Hypertune source. Options
* with generated types are defined in your generated code.
*/
export type CreateOptions = {
/**
* branchName allows you to specify alternative Hypertune branch to initialize
* from. This can be useful for testing logic and schema changes, as well as
* rolling out breaking schema changes, as different schema versions can be
* served at the same time on different branches during the migration.
* branchName allows you to specify a Hypertune branch to initialize from.
* This is useful for testing large logic and schema changes, especially
* breaking schema changes, as different schema versions can be served at the
* same time on different branches during a migration.
*/

@@ -575,5 +576,4 @@ branchName?: string;

* initData specifies initial InitData for the SDK, so that it can be used
* immediately. It can come from a static snapshot in the generated code, from
* dehydrate state or it can even be specified manually in testing for
* example.
* immediately. You can provide this via a build-time snapshot in your
* generated client or via hydration or even manually, e.g. in unit tests.
*/

@@ -584,9 +584,8 @@ initData?: InitData;

*
* When set to null the SDK won't fetch any initialization data and will
* instead solely rely on the static snapshot from your generated file and
* data provided by calling the hydrate method.
* When set to null the SDK won't fetch any initialization data so it will
* rely on a build-time snapshot in your generated client or hydration.
*
* When set to undefined it will default to HypertuneEdgeInitDataProvider.
*
* If you want to fetch data from Vercel Edge config, then set this to a new
* If you want to initialize from Vercel Edge Config, then set this to a new
* instance of VercelEdgeConfigInitDataProvider.

@@ -598,4 +597,4 @@ *

/**
* initIntervalMs is an interval in milliseconds which determines
* how often will the SDK check for updates.
* initIntervalMs is an interval in milliseconds which determines how often
* the SDK checks for updates.
*

@@ -607,4 +606,4 @@ * When set to 0 the SDK will only fetch your latest commit once on

*
* In a serverless environment this value controls how often the SDK will
* check for updates when calling initIfNeeded.
* In a serverless environment, this value controls how often the SDK checks
* for updates when you use the initIfNeeded method.
*

@@ -624,16 +623,15 @@ * @default 1000

/**
* mode controls the amount of SDK log messages, expression evaluations,
* A/B test exposures and events that are sent to the remote server.
* mode determines how log messages, expression evaluations, A/B test
* exposures and analytics events are sent to the remote server.
*
* In "normal" mode all data is sent to the remote server.
* When set to "normal", all data is sent to the remote server.
*
* When it's set to "off" no data will be sent to the remote server. This
* can be useful in local or testing environments.
* When set to "off", no data is sent to the remote server. This is useful
* in development and test environments.
*
* When the mode is set to "session" then SDK log messages, expression
* evaluations and A/B test exposures are deduplicated per session. This is
* based on the provided context. However, all events are sent to the remote
* server even in session mode.
* When set to "session", log messages, expression evaluations and A/B test
* exposures are deduplicated per session, based on the provided context.
* However, all analytics events are still sent to the remote server.
*
* @default "normal" ("session" in a browser)
* @default "normal" ("session" when the SDK is used in the browser)
*/

@@ -643,4 +641,5 @@ mode?: RemoteLoggingMode;

* endpointUrl allows you to send SDK log messages, expression evaluations,
* A/B test exposures and events to your own server and then forward them to
* Hypertune Edge or to your own analytics or observability tools.
* A/B test exposures and analytics events to your own server. You can then
* forward them to Hypertune Edge or your own analytics or observability
* tools.
*

@@ -652,6 +651,6 @@ * @default https://gcp.fasthorse.workers.dev/logs

* flushIntervalMs is an interval in milliseconds which determines how often
* the SDK will try to flush logs to the remote server.
* the SDK flushes logs to the remote server.
*
* When set to 0 the SDK will never try to automatically flush logs so you
* would need to flush manually with the flushLogs method.
* When set to 0 the SDK will never automatically flush logs. In this case,
* you would need to flush logs manually using the flushLogs method.
*

@@ -671,5 +670,5 @@ * @default 1000 (0 in serverless environments)

};
export type DeepPartial<T> = T extends (infer U)[] ? DeepPartial<U>[] | undefined : T extends object ? {
export type DeepPartial<T> = (T extends (infer U)[] ? DeepPartial<U>[] : T extends object ? {
[P in keyof T]?: DeepPartial<T[P]>;
} : T;
} : T) | undefined;
export type CreateLogsInput = {

@@ -676,0 +675,0 @@ evaluations: EvaluationCountInput[];

{
"name": "hypertune",
"version": "2.1.1",
"version": "2.1.2",
"private": false,

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -14,2 +14,3 @@ import "regenerator-runtime/runtime";

import Node from "./lib/Node";
import merge from "./lib/merge";
import HypertuneEdgeInitDataProvider from "./lib/initDataProviders/HypertuneEdgeInitDataProvider";

@@ -31,2 +32,3 @@ import VercelEdgeConfigInitDataProvider from "./lib/initDataProviders/VercelEdgeConfigInitDataProvider";

DeepPartial,
merge,
};

@@ -33,0 +35,0 @@

@@ -56,3 +56,3 @@ import pRetry from "p-retry";

// @internal
public override: object | null;
public override: DeepPartial<ObjectValue> | null;

@@ -462,3 +462,3 @@ // eslint-disable-next-line max-params

// @internal
setOverride<TOverride extends object>(
setOverride<TOverride extends ObjectValue>(
traceId: string,

@@ -525,3 +525,3 @@ override: DeepPartial<TOverride> | null

// @internal
hydrate<TOverride extends object, TVariableValues extends ObjectValue>(
hydrate<TOverride extends ObjectValue, TVariableValues extends ObjectValue>(
traceId: string,

@@ -528,0 +528,0 @@ dehydratedState: DehydratedState<TOverride, TVariableValues>

@@ -26,3 +26,3 @@ /* eslint-disable no-underscore-dangle */

import getMetadata from "../shared/helpers/getMetadata";
import mergeValueAndOverride from "../shared/helpers/mergeValueAndOverride";
import merge from "./merge";
import throwIfObjectValueIsInvalid from "../shared/helpers/throwIfObjectValueIsInvalid";

@@ -294,6 +294,3 @@ import Context from "./Context";

const value = mergeValueAndOverride(
valueWithoutOverride,
this.getNodeOverride()
);
const value = merge(valueWithoutOverride, this.getNodeOverride());

@@ -310,7 +307,7 @@ this.log(

private getNodeOverride(): any {
private getNodeOverride(): DeepPartial<Value> {
const { context, parent, step } = this.props;
if (!context) {
return null;
return undefined;
}

@@ -320,3 +317,3 @@

// Short-circuit if no override in context
return null;
return undefined;
}

@@ -326,7 +323,7 @@

// We're the Query node
return context.override ?? null;
return context.override ?? undefined;
}
if (!step) {
return null;
return undefined;
}

@@ -337,10 +334,10 @@

if (parentOverride === null || parentOverride === undefined) {
return null;
return undefined;
}
if (step.type === "GetFieldStep") {
return (parentOverride as ObjectValue)[step.fieldName] ?? null;
return (parentOverride as ObjectValue)[step.fieldName] ?? undefined;
}
return (parentOverride as Value[])[step.index] ?? null;
return (parentOverride as Value[])[step.index] ?? undefined;
}

@@ -556,3 +553,3 @@

setOverride<T extends object>(
setOverride<T extends ObjectValue>(
override: DeepPartial<T>,

@@ -559,0 +556,0 @@ traceId = uniqueId()

@@ -469,2 +469,4 @@ /* eslint-disable capitalized-comments */

name: string;
description?: string;
archived?: boolean;
dimensions: { [dimensionId: string]: Dimension };

@@ -785,12 +787,11 @@ eventObjectTypeName: string | null; // refers to event object schema definition

/**
* CreateOptions contains all statically typed options that are used to create
* hypertune source. Options that rely on types in generated code are defined
* there instead.
* CreateOptions contains options used to create the Hypertune source. Options
* with generated types are defined in your generated code.
*/
export type CreateOptions = {
/**
* branchName allows you to specify alternative Hypertune branch to initialize
* from. This can be useful for testing logic and schema changes, as well as
* rolling out breaking schema changes, as different schema versions can be
* served at the same time on different branches during the migration.
* branchName allows you to specify a Hypertune branch to initialize from.
* This is useful for testing large logic and schema changes, especially
* breaking schema changes, as different schema versions can be served at the
* same time on different branches during a migration.
*/

@@ -801,5 +802,4 @@ branchName?: string;

* initData specifies initial InitData for the SDK, so that it can be used
* immediately. It can come from a static snapshot in the generated code, from
* dehydrate state or it can even be specified manually in testing for
* example.
* immediately. You can provide this via a build-time snapshot in your
* generated client or via hydration or even manually, e.g. in unit tests.
*/

@@ -810,9 +810,8 @@ initData?: InitData;

*
* When set to null the SDK won't fetch any initialization data and will
* instead solely rely on the static snapshot from your generated file and
* data provided by calling the hydrate method.
* When set to null the SDK won't fetch any initialization data so it will
* rely on a build-time snapshot in your generated client or hydration.
*
* When set to undefined it will default to HypertuneEdgeInitDataProvider.
*
* If you want to fetch data from Vercel Edge config, then set this to a new
* If you want to initialize from Vercel Edge Config, then set this to a new
* instance of VercelEdgeConfigInitDataProvider.

@@ -824,4 +823,4 @@ *

/**
* initIntervalMs is an interval in milliseconds which determines
* how often will the SDK check for updates.
* initIntervalMs is an interval in milliseconds which determines how often
* the SDK checks for updates.
*

@@ -833,4 +832,4 @@ * When set to 0 the SDK will only fetch your latest commit once on

*
* In a serverless environment this value controls how often the SDK will
* check for updates when calling initIfNeeded.
* In a serverless environment, this value controls how often the SDK checks
* for updates when you use the initIfNeeded method.
*

@@ -851,16 +850,15 @@ * @default 1000

/**
* mode controls the amount of SDK log messages, expression evaluations,
* A/B test exposures and events that are sent to the remote server.
* mode determines how log messages, expression evaluations, A/B test
* exposures and analytics events are sent to the remote server.
*
* In "normal" mode all data is sent to the remote server.
* When set to "normal", all data is sent to the remote server.
*
* When it's set to "off" no data will be sent to the remote server. This
* can be useful in local or testing environments.
* When set to "off", no data is sent to the remote server. This is useful
* in development and test environments.
*
* When the mode is set to "session" then SDK log messages, expression
* evaluations and A/B test exposures are deduplicated per session. This is
* based on the provided context. However, all events are sent to the remote
* server even in session mode.
* When set to "session", log messages, expression evaluations and A/B test
* exposures are deduplicated per session, based on the provided context.
* However, all analytics events are still sent to the remote server.
*
* @default "normal" ("session" in a browser)
* @default "normal" ("session" when the SDK is used in the browser)
*/

@@ -870,4 +868,5 @@ mode?: RemoteLoggingMode;

* endpointUrl allows you to send SDK log messages, expression evaluations,
* A/B test exposures and events to your own server and then forward them to
* Hypertune Edge or to your own analytics or observability tools.
* A/B test exposures and analytics events to your own server. You can then
* forward them to Hypertune Edge or your own analytics or observability
* tools.
*

@@ -879,6 +878,6 @@ * @default https://gcp.fasthorse.workers.dev/logs

* flushIntervalMs is an interval in milliseconds which determines how often
* the SDK will try to flush logs to the remote server.
* the SDK flushes logs to the remote server.
*
* When set to 0 the SDK will never try to automatically flush logs so you
* would need to flush manually with the flushLogs method.
* When set to 0 the SDK will never automatically flush logs. In this case,
* you would need to flush logs manually using the flushLogs method.
*

@@ -909,9 +908,9 @@ * @default 1000 (0 in serverless environments)

export type DeepPartial<T> = T extends (infer U)[]
? DeepPartial<U>[] | undefined
: T extends object
? {
[P in keyof T]?: DeepPartial<T[P]>;
}
: T;
export type DeepPartial<T> =
| (T extends (infer U)[]
? DeepPartial<U>[]
: T extends object
? { [P in keyof T]?: DeepPartial<T[P]> }
: T)
| undefined;

@@ -918,0 +917,0 @@ // Logs endpoint schema

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc