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

@cardano-graphql/util

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cardano-graphql/util - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0-beta.0

2

dist/index.d.ts
import { loadQueryNode } from './queryNodeLoading';
import * as dateTimeValidation from './dateTimeValidation';
import * as scalars from './scalars';
declare const _default: {
dateTimeValidation: typeof dateTimeValidation;
onFailedAttemptFor: (operation: string) => ({ attemptNumber, message, retriesLeft }: import("p-retry").FailedAttemptError) => void;

@@ -7,0 +5,0 @@ loadQueryNode: typeof loadQueryNode;

@@ -24,6 +24,4 @@ "use strict";

const queryNodeLoading_1 = require("./queryNodeLoading");
const dateTimeValidation = __importStar(require("./dateTimeValidation"));
const scalars = __importStar(require("./scalars"));
exports.default = {
dateTimeValidation,
onFailedAttemptFor: onFailedAttemptFor_1.onFailedAttemptFor,

@@ -30,0 +28,0 @@ loadQueryNode: queryNodeLoading_1.loadQueryNode,

28

dist/scalars/DateTimeUtcToIso.js
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DateTimeUtcToIso = void 0;
const graphql_1 = require("graphql");
const graphql_scalars_1 = require("graphql-scalars");
const dateTimeValidation_1 = require("../dateTimeValidation");
function isoToUtc(isoString) {
return isoString.substring(0, isoString.length - 5);
const dayjs_1 = __importDefault(require("dayjs"));
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
dayjs_1.default.extend(utc_1.default);
function isIsoDateString(string) {
const isoDateRegExp = new RegExp(/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))/);
return isoDateRegExp.test(string);
}
exports.DateTimeUtcToIso = new graphql_1.GraphQLScalarType({
name: 'DateTime',
description: 'UTC DateTime to ISO RFC 3339',
description: 'DateTime ISO 8601',
serialize(value) {
return graphql_scalars_1.DateTimeResolver.serialize.call(this, `${value}Z`).toISOString();
if (isIsoDateString(value)) {
return value;
}
return dayjs_1.default.utc(value).format('YYYY-MM-DDTHH:mm:ss[Z]');
},

@@ -20,6 +28,6 @@ parseValue(value) {

}
if (!dateTimeValidation_1.validateDateTime(value)) {
if (!isIsoDateString(value)) {
throw new TypeError(`DateTime cannot represent an invalid date-time-string ${value}.`);
}
return isoToUtc(value);
return dayjs_1.default.utc(value).format('YYYY-MM-DDTHH:mm:ss');
},

@@ -31,8 +39,8 @@ parseLiteral(ast) {

const { value } = ast;
if (!dateTimeValidation_1.validateDateTime(value)) {
if (!isIsoDateString(value)) {
throw new TypeError(`DateTime cannot represent an invalid date-time-string ${String(value)}.`);
}
return isoToUtc(value);
return dayjs_1.default.utc(value).format('YYYY-MM-DDTHH:mm:ss');
}
});
//# sourceMappingURL=DateTimeUtcToIso.js.map
{
"name": "@cardano-graphql/util",
"version": "1.0.0",
"version": "2.0.0-beta.0",
"description": "Common utilities",

@@ -25,2 +25,3 @@ "main": "dist/index.js",

"dependencies": {
"dayjs": "^1.8.29",
"graphql": "14.5.8",

@@ -33,2 +34,3 @@ "graphql-bigint": "^1.0.0",

"@types/node": "^14.0.13",
"shx": "^0.3.2",
"typescript": "^3.9.5"

@@ -35,0 +37,0 @@ },

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