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

@prismicio/api-renderer

Package Overview
Dependencies
Maintainers
0
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prismicio/api-renderer - npm Package Compare versions

Comparing version 3.2.4-alpha.1 to 3.2.4-alpha.2

7

lib/models/extension/Encoder.d.ts

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

export declare function encodeDocId(documentId: string, additionalData?: Record<string, string>): string;
export interface IDEncoder {
encode: (strId: string) => string;
}
export declare function IDEncoder(prefix: string): IDEncoder;
export declare const IDEncoders: {
documentLinks: IDEncoder;
documentUrls: IDEncoder;
integrationFields: IDEncoder;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IDEncoders = exports.IDEncoder = exports.encodeDocId = void 0;
const DOC_SEPARATOR = "%%";
function encodeDocId(documentId, additionalData) {
const result = [documentId];
if (additionalData && Object.keys(additionalData).length > 0) {
result.push(JSON.stringify(additionalData));
}
return result.join(DOC_SEPARATOR);
}
exports.encodeDocId = encodeDocId;
function IDEncoder(prefix) {
return {
encode: (strId) => `${prefix}#${strId}`,
};
}
exports.IDEncoder = IDEncoder;
exports.IDEncoders = {
documentLinks: IDEncoder("=&="),
documentUrls: IDEncoder(">&<"),
integrationFields: IDEncoder("%!%"),
};

2

lib/models/extension/index.d.ts

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

export { type IDEncoder, encodeDocId, IDEncoders } from "./Encoder";
export { type IDEncoder } from "./Encoder";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IDEncoders = exports.encodeDocId = void 0;
var Encoder_1 = require("./Encoder");
Object.defineProperty(exports, "encodeDocId", { enumerable: true, get: function () { return Encoder_1.encodeDocId; } });
Object.defineProperty(exports, "IDEncoders", { enumerable: true, get: function () { return Encoder_1.IDEncoders; } });

@@ -8,3 +8,3 @@ import type { ApiDocument } from "./ApiDocument";

DocEncoder: {
encodeDocId(documentId: string, additionalData?: Record<string, string>): string;
encodeDocId(documentId: string, additionalData?: (string | undefined)[]): string;
};

@@ -11,0 +11,0 @@ encoders: {

@@ -23,6 +23,3 @@ "use strict";

try {
const id = ctx.Extension.DocEncoder.encodeDocId(link.id, {
...((fetch === null || fetch === void 0 ? void 0 : fetch.uuid) && { fetchUUID: fetch === null || fetch === void 0 ? void 0 : fetch.uuid }),
...(link.text && { text: link.text }),
});
const id = ctx.Extension.DocEncoder.encodeDocId(link.id, [fetch === null || fetch === void 0 ? void 0 : fetch.uuid, link.text]);
return {

@@ -40,6 +37,3 @@ type: "Link.document",

try {
const id = ctx.Extension.DocEncoder.encodeDocId(link.id, {
...((fetch === null || fetch === void 0 ? void 0 : fetch.uuid) && { fetchUUID: fetch === null || fetch === void 0 ? void 0 : fetch.uuid }),
...(link.text && { text: link.text }),
});
const id = ctx.Extension.DocEncoder.encodeDocId(link.id, [fetch === null || fetch === void 0 ? void 0 : fetch.uuid, link.text]);
return ctx.Extension.encoders.documentLinks.encode(id);

@@ -46,0 +40,0 @@ }

{
"name": "@prismicio/api-renderer",
"version": "3.2.4-alpha.1",
"version": "3.2.4-alpha.2",
"description": "Prismic renderers for the content API",

@@ -5,0 +5,0 @@ "keywords": [

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

const DOC_SEPARATOR = "%%"
export function encodeDocId(documentId: string, additionalData?: Record<string, string>): string {
const result = [documentId]
if (additionalData && Object.keys(additionalData).length > 0) {
result.push(JSON.stringify(additionalData))
}
return result.join(DOC_SEPARATOR)
}
export interface IDEncoder {
encode: (strId: string) => string
}
export function IDEncoder(prefix: string): IDEncoder {
return {
encode: (strId: string): string => `${prefix}#${strId}`,
}
}
export const IDEncoders = {
documentLinks: IDEncoder("=&="),
documentUrls: IDEncoder(">&<"),
integrationFields: IDEncoder("%!%"),
}

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

export { type IDEncoder, encodeDocId, IDEncoders } from "./Encoder"
export { type IDEncoder } from "./Encoder"

@@ -9,3 +9,3 @@ import type { ApiDocument } from "./ApiDocument"

DocEncoder: {
encodeDocId(documentId: string, additionalData?: Record<string, string>): string
encodeDocId(documentId: string, additionalData?: (string | undefined)[]): string
}

@@ -12,0 +12,0 @@ encoders: {

@@ -31,6 +31,3 @@ import type { DocumentLinkContent } from "@prismicio/types-internal/lib/content"

try {
const id = ctx.Extension.DocEncoder.encodeDocId(link.id, {
...(fetch?.uuid && { fetchUUID: fetch?.uuid }),
...(link.text && { text: link.text }),
})
const id = ctx.Extension.DocEncoder.encodeDocId(link.id, [fetch?.uuid, link.text])
return {

@@ -48,6 +45,3 @@ type: "Link.document",

try {
const id = ctx.Extension.DocEncoder.encodeDocId(link.id, {
...(fetch?.uuid && { fetchUUID: fetch?.uuid }),
...(link.text && { text: link.text }),
})
const id = ctx.Extension.DocEncoder.encodeDocId(link.id, [fetch?.uuid, link.text])
return ctx.Extension.encoders.documentLinks.encode(id)

@@ -54,0 +48,0 @@ } catch (e) {

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