New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@alpaca-headless/alpaca-headless-editor-preview

Package Overview
Dependencies
Maintainers
2
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alpaca-headless/alpaca-headless-editor-preview - npm Package Compare versions

Comparing version 1.0.301 to 1.0.302

4

dist/components/field-renderers/RichTextRenderer.d.ts

@@ -71,3 +71,3 @@ import "server-only";

"aria-controls"?: string | undefined;
"aria-current"?: boolean | "time" | "true" | "false" | "page" | "location" | "step" | "date" | undefined;
"aria-current"?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
"aria-describedby"?: string | undefined;

@@ -343,3 +343,3 @@ "aria-description"?: string | undefined;

"aria-controls"?: string | undefined;
"aria-current"?: boolean | "time" | "true" | "false" | "page" | "location" | "step" | "date" | undefined;
"aria-current"?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
"aria-describedby"?: string | undefined;

@@ -346,0 +346,0 @@ "aria-description"?: string | undefined;

@@ -70,3 +70,3 @@ import React from "react";

"aria-controls"?: string | undefined;
"aria-current"?: boolean | "time" | "true" | "false" | "page" | "location" | "step" | "date" | undefined;
"aria-current"?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
"aria-describedby"?: string | undefined;

@@ -73,0 +73,0 @@ "aria-description"?: string | undefined;

@@ -9,3 +9,3 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";

import { ErrorFallback } from "./Error";
import { alpacaHeadless } from "..";
import { alpacaHeadless } from "../internals";
export async function Placeholder({ name, content, tag, className, description, mapComponent, getComponentProps, context, }) {

@@ -12,0 +12,0 @@ const parentData = content;

import "server-only";
import { alpacaHeadless } from "..";
import { alpacaHeadless } from "../internals";
export function Translate({ text, context, }) {

@@ -4,0 +4,0 @@ const dictionary = context.dictionary;

@@ -9,3 +9,2 @@ /// <reference types="react" />

export type Dependencies = {
getRenderingById: (rendering: RenderingReference, compileRendering: (rendering: Rendering) => Promise<any>) => Promise<any>;
fetch: (input: RequestInfo, init?: AlpacaRequestInit) => Promise<Response>;

@@ -16,2 +15,3 @@ cookies: () => string;

export type Configuration = {
getRenderingById: (rendering: RenderingReference, compileRendering: (rendering: Rendering) => Promise<any>) => Promise<any>;
fieldRendererResolver: (props: FieldRendererProps, rendererType: string) => React.ComponentType<any>;

@@ -18,0 +18,0 @@ dependencies: Dependencies;

@@ -5,14 +5,3 @@ import { defaultFieldRendererResolver, } from "./field-renderers";

fieldRendererResolver: defaultFieldRendererResolver,
dependencies: {
fetch: () => {
throw new Error("Not implemented");
},
headers: () => {
throw new Error("Not implemented");
},
cookies: () => {
throw new Error("Not implemented");
},
getRenderingById,
},
getRenderingById,
};
import { TextRenderer } from "./components/field-renderers/TextRenderer";
import { alpacaHeadless } from ".";
import { alpacaHeadless } from "./internals";
import { PictureRenderer } from "./components/field-renderers/PictureRenderer";

@@ -4,0 +4,0 @@ import { RichTextRenderer } from "./components/field-renderers/RichTextRenderer";

@@ -1,5 +0,3 @@

import { Configuration } from "./configuration";
export { resolveRoute, getPage } from "./route-data/resolve-route";
export { executeGraphQLQuery } from "./services/graphQL";
export { createRenderContext } from "./render-context";
export type { ResolveRouteParams, GetPageParams, } from "./route-data/resolve-route";
export type { PageResult, ErrorResult, NotFoundResult, RedirectResult, UnauthorizedResult, } from "./route-data/results";
export type { RenderOptions, LazyPlaceholder, RenderingProps, ServerRenderContext, ClientRenderContext, } from "./render-context";

@@ -15,5 +13,1 @@ export type { PlaceholderData, ComponentData, RenderingReference, Page, } from "./types/layoutDataTypes";

export { Translate } from "./components/Translate";
export declare const alpacaHeadless: {
configuration: Configuration;
isInitialized: boolean;
};

@@ -1,5 +0,1 @@

import { configuration } from "./configuration";
export { resolveRoute, getPage } from "./route-data/resolve-route";
export { executeGraphQLQuery } from "./services/graphQL";
export { createRenderContext } from "./render-context";
export { Placeholder } from "./components/Placeholder";

@@ -11,5 +7,1 @@ export { Picture } from "./components/field-renderers/wrappers/Picture";

export { Translate } from "./components/Translate";
if (!globalThis.alpacaHeadless) {
globalThis.alpacaHeadless = { configuration, isInitialized: false };
}
export const alpacaHeadless = globalThis.alpacaHeadless;

@@ -0,1 +1,2 @@

import { Configuration } from "../configuration";
export type { PlaceholderComponent } from "../components/Placeholder";

@@ -6,1 +7,6 @@ export { renderPlaceholder } from "../components/Placeholder";

export { PictureRenderer } from "../components/field-renderers/PictureRenderer";
export { resolveRoute as _resolveRoute, getPage as _getPage, } from "../route-data/resolve-route";
export { executeGraphQLQuery as _executeGraphQLQuery, getGraphQLSchema as _getGraphQLSchema, } from "../services/graphQL";
export declare const alpacaHeadless: {
configuration: Configuration;
};

@@ -0,2 +1,9 @@

import { configuration } from "../configuration";
export { renderPlaceholder } from "../components/Placeholder";
export { PictureRenderer } from "../components/field-renderers/PictureRenderer";
export { resolveRoute as _resolveRoute, getPage as _getPage, } from "../route-data/resolve-route";
export { executeGraphQLQuery as _executeGraphQLQuery, getGraphQLSchema as _getGraphQLSchema, } from "../services/graphQL";
if (!globalThis.alpacaHeadless) {
globalThis.alpacaHeadless = { configuration };
}
export const alpacaHeadless = globalThis.alpacaHeadless;

@@ -1,2 +0,2 @@

import { resolveRoute } from "../index";
import { resolveRoute } from "../route-data/resolve-route";
export async function handleRequest({ request, mapHost, renderOptions, }) {

@@ -3,0 +3,0 @@ const urlSearchParams = new URLSearchParams(request.nextUrl.search);

@@ -1,2 +0,2 @@

import { alpacaHeadless } from ".";
import { alpacaHeadless } from "./internals";
import { loadDictionary } from "./route-data/dictionary";

@@ -17,3 +17,3 @@ export async function createRenderContext({ page, renderings, renderOptions, compileRendering, }) {

throw new Error("compileRendering is not defined");
return alpacaHeadless.configuration.dependencies.getRenderingById(renderingReference, compileRendering);
return alpacaHeadless.configuration.getRenderingById(renderingReference, compileRendering);
},

@@ -20,0 +20,0 @@ };

@@ -6,3 +6,3 @@ /// <reference types="react" />

import { ErrorResult, NotFoundResult, PageResult, RedirectResult, UnauthorizedResult } from "./results";
export declare function getPage({ itemId, language, version, siteName, renderOptions, renderings, compileRendering, mode, }: {
export type GetPageParams = {
itemId: string;

@@ -18,4 +18,5 @@ language: string;

mode: RenderMode;
}): Promise<PageResult | UnauthorizedResult | RedirectResult | ErrorResult | NotFoundResult>;
export declare function resolveRoute({ path, searchParams, host, renderOptions, renderings, compileRendering, }: {
};
export declare function getPage({ itemId, language, version, siteName, renderOptions, renderings, compileRendering, mode, }: GetPageParams): Promise<PageResult | UnauthorizedResult | RedirectResult | ErrorResult | NotFoundResult>;
export type ResolveRouteParams = {
path: string[] | string;

@@ -29,3 +30,4 @@ searchParams: any;

}) => Promise<React.ComponentType<any> | null>;
}): Promise<PageResult | ErrorResult | RedirectResult | NotFoundResult | UnauthorizedResult>;
};
export declare function resolveRoute({ path, searchParams, host, renderOptions, renderings, compileRendering, }: ResolveRouteParams): Promise<PageResult | ErrorResult | RedirectResult | NotFoundResult | UnauthorizedResult>;
export declare const loadPartialLayout: (itemId: string, language: string, version: number, component: ItemDescriptor | undefined, placeholderKey: string, options: RenderOptions, siteName: string, mode: string) => Promise<PageResult | null>;

@@ -1,2 +0,2 @@

import { createRenderContext } from "..";
import { createRenderContext } from "../render-context";
import { apiPostObject } from "../services/api";

@@ -3,0 +3,0 @@ const fetchRouteData = async (path, host, mode, itemId, language, version, options, siteName) => {

import "server-only";
import { alpacaHeadless } from "..";
import { alpacaHeadless } from "../internals";
export async function apiGet(route, options) {

@@ -53,4 +53,11 @@ const url = process.env.LAYOUT_SERVICE_URL + route;

}
const json = await response.json();
return { data: json, status: 200, headers: response.headers };
const contentType = response.headers.get("content-type");
if (!contentType || !contentType.includes("application/json")) {
const json = await response.json();
return { data: json, status: 200, headers: response.headers };
}
else {
const text = await response.text();
return { data: text, status: 200, headers: response.headers };
}
}

@@ -57,0 +64,0 @@ export function getApiKey() {

@@ -13,1 +13,12 @@ export declare function executeGraphQLQuery({ query, host, path, language, mode, itemId, version, tags, revalidate, siteName, }: {

}, sessionId?: string): Promise<any>;
export declare function getGraphQLSchema({ host, path, language, mode, itemId, version, tags, revalidate, siteName, }: {
tags?: string[];
host?: string;
path?: string;
language?: string;
mode?: string;
itemId?: string;
version?: number;
revalidate?: number;
siteName?: string;
}): Promise<any>;

@@ -17,16 +17,2 @@ import { apiPostObject } from "./api";

};
// const response = await fetch(url, {
// method: "POST",
// credentials: "include",
// headers: {
// "Content-Type": "application/json",
// Cookie: cookies().toString(),
// "x-api-key": getApiKey(),
// } as HeadersInit & { "x-api-key": string },
// body: JSON.stringify(request),
// next: {
// tags: tags ?? ["graphql"],
// revalidate: revalidate,
// },
// });
const response = await apiPostObject(url, request, { tags, revalidate });

@@ -40,1 +26,20 @@ if (response.status !== 200) {

}
export async function getGraphQLSchema({ host, path, language, mode, itemId, version, tags, revalidate, siteName, }) {
let url = "/alpaca/headless/graphql/schema";
const request = {
Host: host,
Path: path,
ItemId: itemId,
Language: language,
Version: version,
Mode: mode,
SiteName: siteName,
};
const response = await apiPostObject(url, request, { tags, revalidate });
if (response.status !== 200) {
console.log("Could not fetch graphql schema. Response code: " + response.status);
console.log(response.error);
return {};
}
return response.data;
}
{
"name": "@alpaca-headless/alpaca-headless-editor-preview",
"version": "1.0.301",
"version": "1.0.302",
"type": "module",

@@ -5,0 +5,0 @@ "description": "Alpaca Headless",

@@ -17,2 +17,8 @@ import {

export type Dependencies = {
fetch: (input: RequestInfo, init?: AlpacaRequestInit) => Promise<Response>;
cookies: () => string;
headers: () => Headers;
};
export type Configuration = {
getRenderingById: (

@@ -28,8 +34,2 @@ rendering: RenderingReference,

) => Promise<any>;
fetch: (input: RequestInfo, init?: AlpacaRequestInit) => Promise<Response>;
cookies: () => string;
headers: () => Headers;
};
export type Configuration = {
fieldRendererResolver: (

@@ -53,14 +53,3 @@ props: FieldRendererProps,

fieldRendererResolver: defaultFieldRendererResolver,
dependencies: {
fetch: () => {
throw new Error("Not implemented");
},
headers: () => {
throw new Error("Not implemented");
},
cookies: () => {
throw new Error("Not implemented");
},
getRenderingById,
},
getRenderingById,
} as Configuration;
import { TextRenderer } from "./components/field-renderers/TextRenderer";
import { Field, alpacaHeadless } from ".";
import { Field } from ".";
import { alpacaHeadless } from "./internals";
import { PictureRenderer } from "./components/field-renderers/PictureRenderer";

@@ -4,0 +5,0 @@ import { RichTextRenderer } from "./components/field-renderers/RichTextRenderer";

@@ -1,7 +0,15 @@

import { Configuration, configuration } from "./configuration";
export { resolveRoute, getPage } from "./route-data/resolve-route";
export { executeGraphQLQuery } from "./services/graphQL";
export { createRenderContext } from "./render-context";
export type {
ResolveRouteParams,
GetPageParams,
} from "./route-data/resolve-route";
export type {
PageResult,
ErrorResult,
NotFoundResult,
RedirectResult,
UnauthorizedResult,
} from "./route-data/results";
export type {
RenderOptions,

@@ -45,10 +53,1 @@ LazyPlaceholder,

export { Translate } from "./components/Translate";
if (!(globalThis as any).alpacaHeadless) {
(globalThis as any).alpacaHeadless = { configuration, isInitialized: false };
}
export const alpacaHeadless = (globalThis as any).alpacaHeadless as {
configuration: Configuration;
isInitialized: boolean;
};

@@ -0,1 +1,3 @@

import { Configuration, configuration } from "../configuration";
export type { PlaceholderComponent } from "../components/Placeholder";

@@ -6,1 +8,18 @@ export { renderPlaceholder } from "../components/Placeholder";

export { PictureRenderer } from "../components/field-renderers/PictureRenderer";
export {
resolveRoute as _resolveRoute,
getPage as _getPage,
} from "../route-data/resolve-route";
export {
executeGraphQLQuery as _executeGraphQLQuery,
getGraphQLSchema as _getGraphQLSchema,
} from "../services/graphQL";
if (!(globalThis as any).alpacaHeadless) {
(globalThis as any).alpacaHeadless = { configuration };
}
export const alpacaHeadless = (globalThis as any).alpacaHeadless as {
configuration: Configuration;
};

@@ -1,3 +0,4 @@

import { RenderOptions, resolveRoute } from "../index";
import { RenderOptions } from "../index";
import { NextRequest } from "next/server";
import { resolveRoute } from "../route-data/resolve-route";

@@ -4,0 +5,0 @@ export async function handleRequest({

@@ -1,2 +0,2 @@

import { alpacaHeadless } from ".";
import { alpacaHeadless } from "./internals";
import { Rendering } from "./renderings/renderings";

@@ -77,3 +77,3 @@ import { loadDictionary } from "./route-data/dictionary";

throw new Error("compileRendering is not defined");
return alpacaHeadless.configuration.dependencies.getRenderingById(
return alpacaHeadless.configuration.getRenderingById(
renderingReference,

@@ -80,0 +80,0 @@ compileRendering

@@ -1,2 +0,3 @@

import { RenderOptions, createRenderContext } from "..";
import { RenderOptions } from "..";
import { createRenderContext } from "../render-context";
import { apiPostObject } from "../services/api";

@@ -79,12 +80,3 @@ import { ItemDescriptor } from "../types/items";

export async function getPage({
itemId,
language,
version,
siteName,
renderOptions,
renderings,
compileRendering,
mode,
}: {
export type GetPageParams = {
itemId: string;

@@ -100,3 +92,14 @@ language: string;

mode: RenderMode;
}) {
};
export async function getPage({
itemId,
language,
version,
siteName,
renderOptions,
renderings,
compileRendering,
mode,
}: GetPageParams) {
const result = await fetchRouteData(

@@ -116,10 +119,3 @@ "",

export async function resolveRoute({
path,
searchParams,
host,
renderOptions,
renderings,
compileRendering,
}: {
export type ResolveRouteParams = {
path: string[] | string;

@@ -133,3 +129,12 @@ searchParams: any;

}) => Promise<React.ComponentType<any> | null>;
}): Promise<
};
export async function resolveRoute({
path,
searchParams,
host,
renderOptions,
renderings,
compileRendering,
}: ResolveRouteParams): Promise<
| PageResult

@@ -136,0 +141,0 @@ | ErrorResult

import "server-only";
import { alpacaHeadless } from "..";
import { alpacaHeadless } from "../internals";

@@ -87,4 +87,10 @@ export type FetchOptions = {

const json = await response.json();
return { data: json, status: 200, headers: response.headers };
const contentType = response.headers.get("content-type");
if (!contentType || !contentType.includes("application/json")) {
const json = await response.json();
return { data: json, status: 200, headers: response.headers };
} else {
const text = await response.text();
return { data: text, status: 200, headers: response.headers };
}
}

@@ -91,0 +97,0 @@

@@ -56,17 +56,2 @@ import { apiPostObject } from "./api";

// const response = await fetch(url, {
// method: "POST",
// credentials: "include",
// headers: {
// "Content-Type": "application/json",
// Cookie: cookies().toString(),
// "x-api-key": getApiKey(),
// } as HeadersInit & { "x-api-key": string },
// body: JSON.stringify(request),
// next: {
// tags: tags ?? ["graphql"],
// revalidate: revalidate,
// },
// });
const response = await apiPostObject(url, request, { tags, revalidate });

@@ -84,1 +69,55 @@

}
export async function getGraphQLSchema({
host,
path,
language,
mode,
itemId,
version,
tags,
revalidate,
siteName,
}: {
tags?: string[];
host?: string;
path?: string;
language?: string;
mode?: string;
itemId?: string;
version?: number;
revalidate?: number;
siteName?: string;
}) {
let url = "/alpaca/headless/graphql/schema";
const request: {
Host?: string;
Path?: string;
ItemId?: string;
Language?: string;
Version?: number;
Mode?: string;
SiteName?: string;
} = {
Host: host,
Path: path,
ItemId: itemId,
Language: language,
Version: version,
Mode: mode,
SiteName: siteName,
};
const response = await apiPostObject(url, request, { tags, revalidate });
if (response.status !== 200) {
console.log(
"Could not fetch graphql schema. Response code: " + response.status
);
console.log(response.error);
return {};
}
return response.data;
}

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