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

@ninetailed/experience.js-shared

Package Overview
Dependencies
Maintainers
2
Versions
377
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ninetailed/experience.js-shared - npm Package Compare versions

Comparing version 7.2.0 to 7.3.0

lib/types/Endpoints/GetProfile.d.ts

98

index.js

@@ -68,2 +68,8 @@ import { z } from 'zod';

const withResponseEnvelope = dataSchema => z.object({
data: dataSchema,
message: z.string(),
error: z.boolean().nullable()
});
const CreateProfileRequestBody = z.object({

@@ -74,10 +80,6 @@ // TODO

});
const CreateProfileResponse = z.object({
message: z.string(),
data: z.object({
profile: Profile,
experiences: z.array(SelectedVariantInfo)
}),
error: z.boolean().nullable()
});
const CreateProfileResponse = withResponseEnvelope(z.object({
profile: Profile,
experiences: z.array(SelectedVariantInfo)
}));

@@ -89,10 +91,6 @@ const UpdateProfileRequestBody = z.object({

});
const UpdateProfileResponse = z.object({
message: z.string(),
data: z.object({
profile: Profile,
experiences: z.array(SelectedVariantInfo)
}),
error: z.boolean().nullable()
});
const UpdateProfileResponse = withResponseEnvelope(z.object({
profile: Profile,
experiences: z.array(SelectedVariantInfo)
}));

@@ -104,9 +102,5 @@ const UpsertManyProfilesRequestBody = z.object({

});
const UpsertManyProfilesResponse = z.object({
message: z.string(),
data: z.object({
profiles: z.array(Profile).optional()
}),
error: z.unknown().nullable()
});
const UpsertManyProfilesResponse = withResponseEnvelope(z.object({
profiles: z.array(Profile).optional()
}));

@@ -239,2 +233,7 @@ const Campaign = z.object({

const GetProfileResponse = withResponseEnvelope(z.object({
profile: Profile,
experiences: z.array(SelectedVariantInfo)
}));
const BASE_URL = 'https://experience.ninetailed.co';

@@ -300,14 +299,7 @@ const FEATURES = {

}
makeRequest(url, payload, name, options) {
retryRequest(request, name, options) {
var _a, _b;
return retry(bail => __awaiter(this, void 0, void 0, function* () {
try {
const response = yield fetchTimeout(this.constructUrl(url, options), {
method: 'POST',
headers: this.constructHeaders(options),
body: JSON.stringify(payload),
timeout: options.timeout || 3000
}, {
fetchImpl: this.fetchImpl
});
const response = yield request;
if (response.status === 503) {

@@ -339,2 +331,36 @@ throw new HttpError(`${name} request failed with status: "[${response.status}] ${response.statusText}".`, 503);

}
makeProfileMutationRequest(url, payload, name, options) {
return this.retryRequest(fetchTimeout(this.constructUrl(url, options), {
method: 'POST',
headers: this.constructHeaders(options),
body: JSON.stringify(payload),
timeout: options.timeout || 3000
}, {
fetchImpl: this.fetchImpl
}), name, options);
}
getProfile(id, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
const requestName = 'Get Profile';
logger.info(`Sending ${requestName} request.`);
try {
const response = yield this.retryRequest(fetchTimeout(this.constructUrl(`/v2/organizations/${this.clientId}/environments/${this.environment}/profiles/${id}`, options), {
method: 'GET',
timeout: options.timeout || 3000
}, {
fetchImpl: this.fetchImpl
}), 'Get Profile', options);
const {
data
} = GetProfileResponse.parse(yield response.json());
logger.debug(`${requestName} request succesfully completed.`);
return data;
} catch (error) {
this.logRequestError(error, {
requestName
});
throw error;
}
});
}
/**

@@ -357,3 +383,3 @@ * Creates a profile and returns it.

try {
const response = yield this.makeRequest(`/v2/organizations/${this.clientId}/environments/${this.environment}/profiles`, body, 'Create Profile', options);
const response = yield this.makeProfileMutationRequest(`/v2/organizations/${this.clientId}/environments/${this.environment}/profiles`, body, 'Create Profile', options);
const {

@@ -389,3 +415,3 @@ data

try {
const response = yield this.makeRequest(`/v2/organizations/${this.clientId}/environments/${this.environment}/profiles/${profileId}`, body, requestName, options);
const response = yield this.makeProfileMutationRequest(`/v2/organizations/${this.clientId}/environments/${this.environment}/profiles/${profileId}`, body, requestName, options);
const {

@@ -423,3 +449,3 @@ data

try {
const response = yield this.makeRequest(`/v2/organizations/${this.clientId}/environments/${this.environment}/events`, body, requestName, Object.assign({
const response = yield this.makeProfileMutationRequest(`/v2/organizations/${this.clientId}/environments/${this.environment}/events`, body, requestName, Object.assign({
plainText: false

@@ -593,3 +619,3 @@ }, options));

name: 'Ninetailed React Analytics SDK',
version: "7.2.0"
version: "7.3.0"
},

@@ -596,0 +622,0 @@ userAgent: ctx.userAgent,

@@ -84,2 +84,3 @@ import { ProfileWithSelectedVariants } from '../types/SelectedVariantInfo/ProfileWithSelectedVariants';

};
type GetProfileRequestOptions = Omit<RequestOptions, 'preflight' | 'plainText'>;
export declare class NinetailedApiClient {

@@ -93,3 +94,5 @@ private readonly clientId;

upsertProfile({ profileId, events }: UpsertProfileParams, options?: RequestOptions): Promise<ProfileWithSelectedVariants>;
private makeRequest;
private retryRequest;
private makeProfileMutationRequest;
getProfile(id: string, options?: GetProfileRequestOptions): Promise<ProfileWithSelectedVariants>;
/**

@@ -96,0 +99,0 @@ * Creates a profile and returns it.

@@ -24,3 +24,2 @@ import { z } from 'zod';

export declare const CreateProfileResponse: z.ZodObject<{
message: z.ZodString;
data: z.ZodObject<{

@@ -296,5 +295,7 @@ profile: z.ZodObject<{

}>;
message: z.ZodString;
error: z.ZodNullable<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
message: string;
error: boolean | null;
data: {

@@ -342,5 +343,5 @@ profile: {

};
error: boolean | null;
}, {
message: string;
error: boolean | null;
data: {

@@ -388,4 +389,3 @@ profile: {

};
error: boolean | null;
}>;
export type CreateProfileResponse = z.infer<typeof CreateProfileResponse>;

@@ -24,3 +24,2 @@ import { z } from 'zod';

export declare const UpdateProfileResponse: z.ZodObject<{
message: z.ZodString;
data: z.ZodObject<{

@@ -296,5 +295,7 @@ profile: z.ZodObject<{

}>;
message: z.ZodString;
error: z.ZodNullable<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
message: string;
error: boolean | null;
data: {

@@ -342,5 +343,5 @@ profile: {

};
error: boolean | null;
}, {
message: string;
error: boolean | null;
data: {

@@ -388,4 +389,3 @@ profile: {

};
error: boolean | null;
}>;
export type UpdateProfileResponse = z.infer<typeof UpdateProfileResponse>;

@@ -24,3 +24,2 @@ import { z } from 'zod';

export declare const UpsertManyProfilesResponse: z.ZodObject<{
message: z.ZodString;
data: z.ZodObject<{

@@ -273,5 +272,7 @@ profiles: z.ZodOptional<z.ZodArray<z.ZodObject<{

}>;
error: z.ZodNullable<z.ZodUnknown>;
message: z.ZodString;
error: z.ZodNullable<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
message: string;
error: boolean | null;
data: {

@@ -314,5 +315,5 @@ profiles?: {

};
error?: unknown;
}, {
message: string;
error: boolean | null;
data: {

@@ -355,4 +356,3 @@ profiles?: {

};
error?: unknown;
}>;
export type UpsertManyProfilesResponse = z.infer<typeof UpsertManyProfilesResponse>;
{
"name": "@ninetailed/experience.js-shared",
"version": "7.2.0",
"version": "7.3.0",
"devDependencies": {

@@ -5,0 +5,0 @@ "@ninetailed/testing-utils": "*"

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