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

@uio-appu/nettskjema-utils

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uio-appu/nettskjema-utils - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

42

dist/index.cjs.js
/**
* Nettskjema utils v0.1.6
* 2023-05-10
* Nettskjema utils v0.1.8
* 2023-05-12
*/

@@ -225,3 +225,3 @@ 'use strict';

questionId: specField.id,
text: field.filename
text: field.file.name
});

@@ -269,3 +269,3 @@ break;

const size = 0;
const url = getAttachmentUrl(submissionId, questionId, attachment.filename ?? '', submission.instance, size);
const url = getAttachmentUrl(submissionId, questionId, attachment.file.name ?? '', submission.instance, size);
const res = await fetch(url, {

@@ -277,7 +277,3 @@ method: 'PUT',

},
body: {
uri: 'file://' + attachment.filepath,
type: attachment.mediaType,
name: attachment.filename
}
body: attachment.file
});

@@ -355,10 +351,3 @@ if (res.status >= 300) {

case 'upload': {
const splitPath = field.filepath.split('/');
const filename = splitPath[splitPath.length - 1];
const fileBlob = {
uri: field.filepath,
name: field.filename ?? filename,
type: field.mediaType
};
formData.append(answersAsMap(question, 'attachment.upload'), fileBlob);
formData.append(answersAsMap(question, 'attachment.upload'), field.file);
break;

@@ -426,9 +415,6 @@ }

};
const validateAttachment = (filePath, mimeType) => {
if (filePath == null || filePath === '' || typeof filePath !== 'string') {
throw new Error(`filepath '${filePath}' must be provided as non-empty string`);
const validateAttachment = (file) => {
if (!(file instanceof File)) {
throw new Error('Attachment must be a File instance');
}
if (mimeType == null || mimeType === '' || typeof mimeType !== 'string') {
throw new Error(`mimeType '${mimeType}' must be provided as non-empty string`);
}
};

@@ -467,10 +453,4 @@ const transformField = (field, value) => {

case 'upload': {
const { filePath, fileAsBase64String, mimeType } = value;
validateAttachment(filePath, mimeType);
return {
...basicFieldValues,
filepath: filePath,
data: fileAsBase64String,
mediaType: mimeType
};
validateAttachment(value);
return { ...basicFieldValues, file: value };
}

@@ -477,0 +457,0 @@ case 'RADIO':

/**
* Nettskjema utils v0.1.6
* 2023-05-10
* Nettskjema utils v0.1.8
* 2023-05-12
*/

@@ -223,3 +223,3 @@ const getBaseUrl = (instance = 'prod') => {

questionId: specField.id,
text: field.filename
text: field.file.name
});

@@ -267,3 +267,3 @@ break;

const size = 0;
const url = getAttachmentUrl(submissionId, questionId, attachment.filename ?? '', submission.instance, size);
const url = getAttachmentUrl(submissionId, questionId, attachment.file.name ?? '', submission.instance, size);
const res = await fetch(url, {

@@ -275,7 +275,3 @@ method: 'PUT',

},
body: {
uri: 'file://' + attachment.filepath,
type: attachment.mediaType,
name: attachment.filename
}
body: attachment.file
});

@@ -353,10 +349,3 @@ if (res.status >= 300) {

case 'upload': {
const splitPath = field.filepath.split('/');
const filename = splitPath[splitPath.length - 1];
const fileBlob = {
uri: field.filepath,
name: field.filename ?? filename,
type: field.mediaType
};
formData.append(answersAsMap(question, 'attachment.upload'), fileBlob);
formData.append(answersAsMap(question, 'attachment.upload'), field.file);
break;

@@ -424,9 +413,6 @@ }

};
const validateAttachment = (filePath, mimeType) => {
if (filePath == null || filePath === '' || typeof filePath !== 'string') {
throw new Error(`filepath '${filePath}' must be provided as non-empty string`);
const validateAttachment = (file) => {
if (!(file instanceof File)) {
throw new Error('Attachment must be a File instance');
}
if (mimeType == null || mimeType === '' || typeof mimeType !== 'string') {
throw new Error(`mimeType '${mimeType}' must be provided as non-empty string`);
}
};

@@ -465,10 +451,4 @@ const transformField = (field, value) => {

case 'upload': {
const { filePath, fileAsBase64String, mimeType } = value;
validateAttachment(filePath, mimeType);
return {
...basicFieldValues,
filepath: filePath,
data: fileAsBase64String,
mediaType: mimeType
};
validateAttachment(value);
return { ...basicFieldValues, file: value };
}

@@ -475,0 +455,0 @@ case 'RADIO':

/**
* Nettskjema utils v0.1.6
* 2023-05-10
* Nettskjema utils v0.1.8
* 2023-05-12
*/

@@ -229,3 +229,3 @@ (function (global, factory) {

questionId: specField.id,
text: field.filename
text: field.file.name
});

@@ -273,3 +273,3 @@ break;

const size = 0;
const url = getAttachmentUrl(submissionId, questionId, attachment.filename ?? '', submission.instance, size);
const url = getAttachmentUrl(submissionId, questionId, attachment.file.name ?? '', submission.instance, size);
const res = await fetch(url, {

@@ -281,7 +281,3 @@ method: 'PUT',

},
body: {
uri: 'file://' + attachment.filepath,
type: attachment.mediaType,
name: attachment.filename
}
body: attachment.file
});

@@ -359,10 +355,3 @@ if (res.status >= 300) {

case 'upload': {
const splitPath = field.filepath.split('/');
const filename = splitPath[splitPath.length - 1];
const fileBlob = {
uri: field.filepath,
name: field.filename ?? filename,
type: field.mediaType
};
formData.append(answersAsMap(question, 'attachment.upload'), fileBlob);
formData.append(answersAsMap(question, 'attachment.upload'), field.file);
break;

@@ -430,9 +419,6 @@ }

};
const validateAttachment = (filePath, mimeType) => {
if (filePath == null || filePath === '' || typeof filePath !== 'string') {
throw new Error(`filepath '${filePath}' must be provided as non-empty string`);
const validateAttachment = (file) => {
if (!(file instanceof File)) {
throw new Error('Attachment must be a File instance');
}
if (mimeType == null || mimeType === '' || typeof mimeType !== 'string') {
throw new Error(`mimeType '${mimeType}' must be provided as non-empty string`);
}
};

@@ -471,10 +457,4 @@ const transformField = (field, value) => {

case 'upload': {
const { filePath, fileAsBase64String, mimeType } = value;
validateAttachment(filePath, mimeType);
return {
...basicFieldValues,
filepath: filePath,
data: fileAsBase64String,
mediaType: mimeType
};
validateAttachment(value);
return { ...basicFieldValues, file: value };
}

@@ -481,0 +461,0 @@ case 'RADIO':

@@ -52,7 +52,3 @@ export type NettskjemaInstance = 'dev' | 'dev2' | 'test' | 'prod';

name: string;
mediaType: string;
filepath: string;
data: string;
filename?: string;
fileManagerId?: string;
file: File;
};

@@ -59,0 +55,0 @@ type UnknownField = {

{
"name": "@uio-appu/nettskjema-utils",
"version": "0.1.7",
"version": "0.1.8",
"description": "Utility functions for webapps integrating with Nettskjema",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

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