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

@prismicio/types-internal

Package Overview
Dependencies
Maintainers
20
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prismicio/types-internal - npm Package Compare versions

Comparing version 2.0.0-alpha.4 to 2.0.0-alpha.5

7

lib/content/Document.js

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

const fp_ts_1 = require("fp-ts");
const Either_1 = require("fp-ts/lib/Either");
const function_1 = require("fp-ts/lib/function");

@@ -20,3 +21,3 @@ const t = tslib_1.__importStar(require("io-ts"));

const parsedW = (0, fields_1.WidgetLegacy)(widgetCtx).decode(widgetValue);
if (!parsedW || (parsedW === null || parsedW === void 0 ? void 0 : parsedW._tag) === "Left")
if (!parsedW || (0, Either_1.isLeft)(parsedW))
return acc;

@@ -44,3 +45,3 @@ return { ...acc, [widgetKey]: parsedW.right };

const decodedValue = LegacyContentCtx_1.FieldOrSliceType.decode(v);
if (decodedValue._tag === "Right") {
if ((0, Either_1.isRight)(decodedValue)) {
return {

@@ -84,3 +85,3 @@ ...acc,

}));
return result._tag === "Left" ? undefined : result.right;
return (0, Either_1.isLeft)(result) ? undefined : result.right;
}

@@ -87,0 +88,0 @@ function encodeToLegacyDocument(document) {

@@ -318,3 +318,3 @@ import * as t from "io-ts";

declare const itemLegacyReader: t.ArrayC<t.TupleC<[t.StringC, t.UnknownC]>>;
export type GroupItemLegacy = t.TypeOf<typeof itemLegacyReader>;
type GroupItemLegacy = t.TypeOf<typeof itemLegacyReader>;
export declare const GroupItemLegacy: (ctx: LegacyContentCtx) => t.Type<{

@@ -321,0 +321,0 @@ __TYPE__: "GroupItemContent";

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

const fp_ts_1 = require("fp-ts");
const Either_1 = require("fp-ts/lib/Either");
const function_1 = require("fp-ts/lib/function");

@@ -26,6 +27,5 @@ const t = tslib_1.__importStar(require("io-ts"));

return acc;
if (result._tag === "Right")
return [...acc, [itemKey, result.right]];
else
if ((0, Either_1.isLeft)(result))
return acc;
return [...acc, [itemKey, result.right]];
}, []);

@@ -32,0 +32,0 @@ return {

@@ -38,3 +38,2 @@ import * as t from "io-ts";

}>]>>;
export type EmbedLegacy = t.TypeOf<typeof EmbedContentLegacy>;
export declare const EmbedLegacy: (ctx: LegacyContentCtx) => t.Type<{

@@ -41,0 +40,0 @@ embed_url: string;

@@ -5,2 +5,3 @@ "use strict";

const tslib_1 = require("tslib");
const Either_1 = require("fp-ts/lib/Either");
const t = tslib_1.__importStar(require("io-ts"));

@@ -58,3 +59,3 @@ const EmptyContent_1 = require("../EmptyContent");

const nullValue = (0, EmptyContent_1.EmptyLegacy)(ctx.fieldType).decode(value);
if (nullValue._tag === "Right")
if ((0, Either_1.isRight)(nullValue))
return nullValue;

@@ -61,0 +62,0 @@ const codec = (() => {

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

const fp_ts_1 = require("fp-ts");
const E = tslib_1.__importStar(require("fp-ts/lib/Either"));
const Either_1 = require("fp-ts/lib/Either");
const function_1 = require("fp-ts/lib/function");

@@ -33,3 +33,3 @@ const t = tslib_1.__importStar(require("io-ts"));

const maybeDecodedMeta = exports.Meta.decode(maybeMeta);
if (E.isRight(maybeDecodedMeta)) {
if ((0, Either_1.isRight)(maybeDecodedMeta)) {
const meta = maybeDecodedMeta.right;

@@ -39,3 +39,3 @@ // if it's an hyperlink it should have data validated as link otherwise we don't care and keep the meta

const decoded = linkCodec.decode(meta.data);
if (decoded._tag === "Left")
if ((0, Either_1.isLeft)(decoded))
return acc;

@@ -60,3 +60,3 @@ return [...acc, { ...meta, data: decoded.right }];

const decoded = linkCodec.decode(meta.data);
if (decoded._tag === "Left")
if ((0, Either_1.isLeft)(decoded))
return acc;

@@ -63,0 +63,0 @@ return [...acc, { ...meta, data: linkCodec.encode(decoded.right) }];

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

const fp_ts_1 = require("fp-ts");
const Either_1 = require("fp-ts/lib/Either");
const function_1 = require("fp-ts/lib/function");

@@ -26,3 +27,3 @@ const t = tslib_1.__importStar(require("io-ts"));

const result = (0, RepeatableContent_1.RepeatableWidgetsLegacy)(itemsCtx).decode(parsedSlice.repeat);
if (!result || result._tag === "Left")
if (!result || (0, Either_1.isLeft)(result))
return;

@@ -38,6 +39,5 @@ return result.right;

return acc;
if (result._tag === "Right")
return { ...acc, [key]: result.right };
else
if ((0, Either_1.isLeft)(result))
return acc;
return { ...acc, [key]: result.right };
}, {});

@@ -44,0 +44,0 @@ return {

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

const fp_ts_1 = require("fp-ts");
const Either_1 = require("fp-ts/lib/Either");
const function_1 = require("fp-ts/lib/function");

@@ -31,3 +32,3 @@ const t = tslib_1.__importStar(require("io-ts"));

const result = (0, RepeatableContent_1.RepeatableWidgetsLegacy)(itemsCtx).decode(parsedSlice.items);
if (!result || result._tag === "Left")
if (!result || (0, Either_1.isLeft)(result))
return;

@@ -45,6 +46,5 @@ return result.right;

return acc;
if (result._tag === "Right")
return { ...acc, [key]: result.right };
else
if ((0, Either_1.isLeft)(result))
return acc;
return { ...acc, [key]: result.right };
}, {});

@@ -51,0 +51,0 @@ return {

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

const fp_ts_1 = require("fp-ts");
const Either_1 = require("fp-ts/lib/Either");
const function_1 = require("fp-ts/lib/function");

@@ -40,3 +41,3 @@ const t = tslib_1.__importStar(require("io-ts"));

const item = (0, Slice_1.SliceLegacy)(itemCtx).decode(parsedSlice.value);
if (!item || item._tag === "Left")
if (!item || (0, Either_1.isLeft)(item))
return t.failure(sliceItem, context);

@@ -43,0 +44,0 @@ return t.success({

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasContentType = exports.hasFieldContentType = void 0;
const Either_1 = require("fp-ts/lib/Either");
const fields_1 = require("./fields");

@@ -10,9 +11,8 @@ function hasFieldContentType(obj) {

typeof obj.type === "string" &&
fields_1.FieldType.decode(obj.type)._tag === "Right");
(0, Either_1.isRight)(fields_1.FieldType.decode(obj.type)));
}
exports.hasFieldContentType = hasFieldContentType;
function hasContentType(obj) {
return ((obj === null || obj === void 0 ? void 0 : obj.__TYPE__) !== undefined &&
typeof obj.__TYPE__ === "string");
return typeof obj.__TYPE__ === "string";
}
exports.hasContentType = hasContentType;
export * from "./CustomType";
export * as Comparators from "./diff";
export * as Section from "./Section";
export * from "./diff";
export * from "./Section";
export * from "./widgets";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Section = exports.Comparators = void 0;
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./CustomType"), exports);
exports.Comparators = tslib_1.__importStar(require("./diff"));
exports.Section = tslib_1.__importStar(require("./Section"));
tslib_1.__exportStar(require("./diff"), exports);
tslib_1.__exportStar(require("./Section"), exports);
tslib_1.__exportStar(require("./widgets"), exports);

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

const tslib_1 = require("tslib");
const fp_ts_1 = require("fp-ts/");
const Either_1 = require("fp-ts/lib/Either");
const function_1 = require("fp-ts/lib/function");
const t = tslib_1.__importStar(require("io-ts"));

@@ -48,6 +50,6 @@ const validators_1 = require("../../../validators");

});
const RichTextOptions = new t.Type("RichTextOptions", (u) => typeof u === "string", (u, context) => {
return Either_1.either.chain(t.union([t.string, t.null]).validate(u, context), (s) => {
const RichTextOptions = new t.Type("RichTextOptions", (u) => typeof u === "string", (u) => {
return (0, function_1.pipe)(t.union([t.string, t.null]).decode(u), fp_ts_1.either.map((s) => {
if (!s)
return t.success(exports.DEFAULT_OPTION);
return exports.DEFAULT_OPTION;
const entries = s.split(",").map((e) => e.trim());

@@ -58,5 +60,5 @@ const filtered = entries.filter((entry) => {

if (!filtered.length)
return t.success(exports.DEFAULT_OPTION);
return t.success(filtered.join(","));
});
return exports.DEFAULT_OPTION;
return filtered.join(",");
}));
}, (a) => a);

@@ -106,5 +108,3 @@ const NoLabels = (labels) => {

const validator = t.readonlyArray(t.string);
return Either_1.either.chain(t
.union([legacyValidator, validator, t.string, t.null])
.validate(u, context), (labels) => {
return (0, function_1.pipe)(t.union([legacyValidator, validator, t.string, t.null]).decode(u), fp_ts_1.either.chain((labels) => {
return (NoLabels(labels) ||

@@ -115,3 +115,3 @@ LabelsAsArray(labels) ||

t.failure(u, context));
});
}));
}, (res) => res);

@@ -118,0 +118,0 @@ exports.RichTextConfig = t.exact(t.partial({

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

export { CompositeSlice } from "./CompositeSlice";
export { LegacySlice } from "./LegacySlice";
export * from "./CompositeSlice";
export * from "./LegacySlice";
export * from "./SharedSlice";
export { SharedSliceRef } from "./SharedSliceRef";
export * as Slice from "./Slice";
export * as SliceZone from "./Slices";
export { SlicesTypes } from "./SlicesTypes";
export * from "./SharedSliceRef";
export * from "./Slice";
export * from "./Slices";
export * from "./SlicesTypes";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SlicesTypes = exports.SliceZone = exports.Slice = exports.SharedSliceRef = exports.LegacySlice = exports.CompositeSlice = void 0;
const tslib_1 = require("tslib");
var CompositeSlice_1 = require("./CompositeSlice");
Object.defineProperty(exports, "CompositeSlice", { enumerable: true, get: function () { return CompositeSlice_1.CompositeSlice; } });
var LegacySlice_1 = require("./LegacySlice");
Object.defineProperty(exports, "LegacySlice", { enumerable: true, get: function () { return LegacySlice_1.LegacySlice; } });
tslib_1.__exportStar(require("./CompositeSlice"), exports);
tslib_1.__exportStar(require("./LegacySlice"), exports);
tslib_1.__exportStar(require("./SharedSlice"), exports);
var SharedSliceRef_1 = require("./SharedSliceRef");
Object.defineProperty(exports, "SharedSliceRef", { enumerable: true, get: function () { return SharedSliceRef_1.SharedSliceRef; } });
exports.Slice = tslib_1.__importStar(require("./Slice"));
exports.SliceZone = tslib_1.__importStar(require("./Slices"));
var SlicesTypes_1 = require("./SlicesTypes");
Object.defineProperty(exports, "SlicesTypes", { enumerable: true, get: function () { return SlicesTypes_1.SlicesTypes; } });
tslib_1.__exportStar(require("./SharedSliceRef"), exports);
tslib_1.__exportStar(require("./Slice"), exports);
tslib_1.__exportStar(require("./Slices"), exports);
tslib_1.__exportStar(require("./SlicesTypes"), exports);

@@ -55,6 +55,6 @@ "use strict";

t.type({
type: t.union([
t.literal(exports.SlicesFieldType),
t.literal(exports.LegacySlicesFieldType),
]),
type: t.keyof({
[exports.SlicesFieldType]: null,
[exports.LegacySlicesFieldType]: null,
}),
}),

@@ -61,0 +61,0 @@ t.partial({

{
"name": "@prismicio/types-internal",
"version": "2.0.0-alpha.4",
"version": "2.0.0-alpha.5",
"description": "Prismic types for Custom Types and Prismic Data",

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

import { either } from "fp-ts"
import { isLeft, isRight } from "fp-ts/lib/Either"
import { pipe } from "fp-ts/lib/function"

@@ -32,3 +33,3 @@ import * as t from "io-ts"

const parsedW = WidgetLegacy(widgetCtx).decode(widgetValue)
if (!parsedW || parsedW?._tag === "Left") return acc
if (!parsedW || isLeft(parsedW)) return acc

@@ -72,3 +73,3 @@ return { ...acc, [widgetKey]: parsedW.right }

const decodedValue = FieldOrSliceType.decode(v)
if (decodedValue._tag === "Right") {
if (isRight(decodedValue)) {
return {

@@ -123,3 +124,3 @@ ...acc,

return result._tag === "Left" ? undefined : result.right
return isLeft(result) ? undefined : result.right
}

@@ -126,0 +127,0 @@

import { either } from "fp-ts"
import { isLeft } from "fp-ts/lib/Either"
import { pipe } from "fp-ts/lib/function"

@@ -23,3 +24,3 @@ import * as t from "io-ts"

const itemLegacyReader = t.array(t.tuple([t.string, t.unknown]))
export type GroupItemLegacy = t.TypeOf<typeof itemLegacyReader>
type GroupItemLegacy = t.TypeOf<typeof itemLegacyReader>

@@ -41,5 +42,4 @@ export const GroupItemLegacy = (ctx: LegacyContentCtx) => {

if (result._tag === "Right")
return [...acc, [itemKey, result.right]]
else return acc
if (isLeft(result)) return acc
return [...acc, [itemKey, result.right]]
},

@@ -46,0 +46,0 @@ [],

@@ -37,3 +37,3 @@ import { either } from "fp-ts"

export type EmbedLegacy = t.TypeOf<typeof EmbedContentLegacy>
type EmbedLegacy = t.TypeOf<typeof EmbedContentLegacy>

@@ -40,0 +40,0 @@ export const EmbedLegacy = (ctx: LegacyContentCtx) =>

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

import { isRight } from "fp-ts/lib/Either"
import * as t from "io-ts"

@@ -122,3 +123,3 @@

const nullValue = EmptyLegacy(ctx.fieldType).decode(value)
if (nullValue._tag === "Right") return nullValue
if (isRight(nullValue)) return nullValue

@@ -125,0 +126,0 @@ const codec = (() => {

import { either } from "fp-ts"
import * as E from "fp-ts/lib/Either"
import { isLeft, isRight } from "fp-ts/lib/Either"
import { pipe } from "fp-ts/lib/function"

@@ -47,3 +47,3 @@ import * as t from "io-ts"

const maybeDecodedMeta = Meta.decode(maybeMeta)
if (E.isRight(maybeDecodedMeta)) {
if (isRight(maybeDecodedMeta)) {
const meta = maybeDecodedMeta.right

@@ -53,3 +53,3 @@ // if it's an hyperlink it should have data validated as link otherwise we don't care and keep the meta

const decoded = linkCodec.decode(meta.data)
if (decoded._tag === "Left") return acc
if (isLeft(decoded)) return acc

@@ -72,3 +72,3 @@ return [...acc, { ...meta, data: decoded.right }]

const decoded = linkCodec.decode(meta.data)
if (decoded._tag === "Left") return acc
if (isLeft(decoded)) return acc

@@ -75,0 +75,0 @@ return [...acc, { ...meta, data: linkCodec.encode(decoded.right) }]

import { either } from "fp-ts"
import { isLeft } from "fp-ts/lib/Either"
import { pipe } from "fp-ts/lib/function"

@@ -47,3 +48,3 @@ import * as t from "io-ts"

)
if (!result || result._tag === "Left") return
if (!result || isLeft(result)) return
return result.right

@@ -61,4 +62,4 @@ })() || []

if (result._tag === "Right") return { ...acc, [key]: result.right }
else return acc
if (isLeft(result)) return acc
return { ...acc, [key]: result.right }
}, {})

@@ -65,0 +66,0 @@

import { either } from "fp-ts"
import { isLeft } from "fp-ts/lib/Either"
import { pipe } from "fp-ts/lib/function"

@@ -46,3 +47,3 @@ import * as t from "io-ts"

)
if (!result || result._tag === "Left") return
if (!result || isLeft(result)) return
return result.right

@@ -63,4 +64,4 @@ })() || []

if (result._tag === "Right") return { ...acc, [key]: result.right }
else return acc
if (isLeft(result)) return acc
return { ...acc, [key]: result.right }
}, {})

@@ -67,0 +68,0 @@

import { either } from "fp-ts"
import { isLeft } from "fp-ts/lib/Either"
import { pipe } from "fp-ts/lib/function"

@@ -57,4 +58,3 @@ import * as t from "io-ts"

const item = SliceLegacy(itemCtx).decode(parsedSlice.value)
if (!item || item._tag === "Left")
return t.failure(sliceItem, context)
if (!item || isLeft(item)) return t.failure(sliceItem, context)

@@ -61,0 +61,0 @@ return t.success({

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

import { isRight } from "fp-ts/lib/Either"
import { FieldContentType, FieldType } from "./fields"

@@ -10,3 +12,3 @@

typeof (obj as WithFieldType).type === "string" &&
FieldType.decode((obj as WithFieldType).type)._tag === "Right"
isRight(FieldType.decode((obj as WithFieldType).type))
)

@@ -17,6 +19,3 @@ }

export function hasContentType(obj: unknown): obj is WithContentType {
return (
(obj as WithContentType)?.__TYPE__ !== undefined &&
typeof (obj as WithContentType).__TYPE__ === "string"
)
return typeof (obj as WithContentType).__TYPE__ === "string"
}
export * from "./CustomType"
export * as Comparators from "./diff"
export * as Section from "./Section"
export * from "./diff"
export * from "./Section"
export * from "./widgets"

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

import { either, getOrElseW } from "fp-ts/lib/Either"
import { either } from "fp-ts/"
import { getOrElseW } from "fp-ts/lib/Either"
import { pipe } from "fp-ts/lib/function"
import * as t from "io-ts"

@@ -54,7 +56,7 @@

(u: unknown): u is string => typeof u === "string",
(u: unknown, context: t.Context) => {
return either.chain(
t.union([t.string, t.null]).validate(u, context),
(s: string | null) => {
if (!s) return t.success(DEFAULT_OPTION)
(u: unknown) => {
return pipe(
t.union([t.string, t.null]).decode(u),
either.map((s: string | null) => {
if (!s) return DEFAULT_OPTION
const entries = s.split(",").map((e: string) => e.trim())

@@ -66,6 +68,6 @@ const filtered = entries.filter((entry) => {

})
if (!filtered.length) return t.success(DEFAULT_OPTION)
if (!filtered.length) return DEFAULT_OPTION
return t.success(filtered.join(","))
},
return filtered.join(",")
}),
)

@@ -174,7 +176,5 @@ },

return either.chain(
t
.union([legacyValidator, validator, t.string, t.null])
.validate(u, context),
(labels) => {
return pipe(
t.union([legacyValidator, validator, t.string, t.null]).decode(u),
either.chain((labels) => {
return (

@@ -187,3 +187,3 @@ NoLabels(labels) ||

)
},
}),
)

@@ -190,0 +190,0 @@ },

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

export { CompositeSlice } from "./CompositeSlice"
export { LegacySlice } from "./LegacySlice"
export * from "./CompositeSlice"
export * from "./LegacySlice"
export * from "./SharedSlice"
export { SharedSliceRef } from "./SharedSliceRef"
export * as Slice from "./Slice"
export * as SliceZone from "./Slices"
export { SlicesTypes } from "./SlicesTypes"
export * from "./SharedSliceRef"
export * from "./Slice"
export * from "./Slices"
export * from "./SlicesTypes"

@@ -80,6 +80,6 @@ import * as t from "io-ts"

t.type({
type: t.union([
t.literal(SlicesFieldType),
t.literal(LegacySlicesFieldType),
]),
type: t.keyof({
[SlicesFieldType]: null,
[LegacySlicesFieldType]: null,
}),
}),

@@ -86,0 +86,0 @@ t.partial({

Sorry, the diff of this file is too big to display

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