@kintone/kintone-js-sdk
Advanced tools
Comparing version 0.5.1 to 0.6.0
{ | ||
"name": "@kintone/kintone-js-sdk", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "The SDK of kintone REST API client on node and browser", | ||
"main": "./src/node/main.js", | ||
"browser": "./src/browser/main.js", | ||
"main": "./cjs/node/main.js", | ||
"browser": "./esm/browser/main.js", | ||
"unpkg": "./dist/kintone-js-sdk.min.js", | ||
@@ -13,3 +13,5 @@ "license": "MIT", | ||
"test-node": "jest ./test/node", | ||
"build": "webpack --mode production", | ||
"build": "cross-env BABEL_ENV=browser webpack --mode production && npm run build:browser && npm run build:node", | ||
"build:browser": "cross-env BABEL_ENV=browser babel src -d esm", | ||
"build:node": "cross-env BABEL_ENV=node babel src -d cjs", | ||
"watch": "webpack --mode development --watch" | ||
@@ -36,6 +38,12 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "7.0.0", | ||
"@babel/cli": "7.5.5", | ||
"@babel/core": "7.5.5", | ||
"@babel/plugin-proposal-class-properties": "7.5.5", | ||
"@babel/plugin-transform-modules-commonjs": "7.5.0", | ||
"@babel/plugin-transform-runtime": "7.5.5", | ||
"@babel/preset-env": "7.0.0", | ||
"@babel/runtime": "7.5.5", | ||
"@cybozu/eslint-config": "3.0.1", | ||
"babel-loader": "8.0.2", | ||
"cross-env": "5.2.1", | ||
"eslint": "5.0.0", | ||
@@ -42,0 +50,0 @@ "jest": "24.8.0", |
# kintone-js-sdk | ||
REST API client of kintone for node.js and javascript | ||
# How to build | ||
## Requirement | ||
``` | ||
* Node.js | ||
* Git | ||
``` | ||
``` | ||
$ git clone https://github.com/kintone/kintone-ui-component.git | ||
$ npm install | ||
$ npm run build | ||
``` | ||
### Output | ||
``` | ||
/dist/kintone-js-sdk.min.js | ||
/esm/browser/main.js | ||
/cjs/node/main.js | ||
``` | ||
# Installation | ||
For CommonJS usage: npm i @kintone/kintone-js-sdk | ||
npm i @kintone/kintone-js-sdk | ||
@@ -24,3 +45,8 @@ ## Note | ||
``` | ||
* ESM: install kintone-js-sdk using "npm i @kintone/kintone-js-sdk"<br/> | ||
``` | ||
import * as kintoneJSSDK from '@kintone/kintone-js-sdk' | ||
``` | ||
# Document | ||
@@ -27,0 +53,0 @@ [kintone-js-sdk](https://kintone.github.io/kintone-js-sdk) |
@@ -1,8 +0,8 @@ | ||
const AUTH_CONST = require('./constant'); | ||
const KintoneCredential = require('../model/authentication/Credential'); | ||
const KintoneHTTPHeader = require('../model/http/HTTPHeader'); | ||
import AUTH_CONST from './constant'; | ||
import KintoneCredential from '../model/authentication/Credential'; | ||
import KintoneHTTPHeader from '../model/http/HTTPHeader'; | ||
/** | ||
* Authentication module | ||
*/ | ||
class Auth { | ||
@@ -102,2 +102,2 @@ constructor() { | ||
module.exports = Auth; | ||
export default Auth; |
@@ -15,2 +15,2 @@ /** | ||
module.exports = constant(); | ||
export default constant(); |
@@ -1,8 +0,7 @@ | ||
const axios = require('axios'); | ||
const Auth = require('../authentication/Auth'); | ||
const HTTPHeader = require('../model/http/HTTPHeader'); | ||
const KintoneAPIException = require('../exception/KintoneAPIException'); | ||
const packageFile = require('../../../package.json'); | ||
const CONNECTION_CONST = require('./constant'); | ||
import axios from 'axios'; | ||
import Auth from '../authentication/Auth'; | ||
import HTTPHeader from '../model/http/HTTPHeader'; | ||
import KintoneAPIException from '../exception/KintoneAPIException'; | ||
import packageFile from'../../../package.json'; | ||
import CONNECTION_CONST from './constant'; | ||
const DEFAULT_PORT = '443'; | ||
@@ -67,3 +66,3 @@ const FILE_RESPONSE_TYPE_KEY = 'responseType'; | ||
// Set request options | ||
const requestOptions = this.options; | ||
const requestOptions = this.copyObject(this.options); | ||
requestOptions.method = method; | ||
@@ -324,2 +323,2 @@ requestOptions.url = uri; | ||
} | ||
module.exports = Connection; | ||
export default Connection ; |
@@ -61,6 +61,6 @@ /** | ||
RECORD_CURSOR: 'records/cursor' | ||
}, | ||
} | ||
}; | ||
}; | ||
module.exports = constant(); | ||
export default constant(); |
@@ -1,7 +0,9 @@ | ||
const KintoneErrorResponseModel = require('../model/exception/ErrorResponse'); | ||
const KintoneAPIExceptionModel = require('../model/exception/KintoneAPIException'); | ||
import _KintoneAPIExceptionModel from "../model/exception/KintoneAPIException"; | ||
import _KintoneErrorResponseModel from "../model/exception/ErrorResponse"; | ||
const KintoneErrorResponseModel = _KintoneErrorResponseModel; | ||
const KintoneAPIExceptionModel = _KintoneAPIExceptionModel; | ||
/** | ||
* kintone Exception Module | ||
*/ | ||
class KintoneAPIException { | ||
@@ -24,3 +26,2 @@ /** | ||
errorResponse = this.getErrorResponse(stringError); | ||
} else if (dataResponse instanceof ArrayBuffer) { | ||
@@ -105,2 +106,2 @@ const stringError = String.fromCharCode(...new Uint8Array(dataResponse)); | ||
module.exports = KintoneAPIException; | ||
export default KintoneAPIException; |
@@ -1,15 +0,10 @@ | ||
/** | ||
* kintone api - nodejs client | ||
* kintoneSDK | ||
*/ | ||
import RecordCursor from "./module/cursor/RecordCursor"; | ||
import KintoneAPIException from "./exception/KintoneAPIException"; | ||
import File from "./module/file/File"; | ||
import Connection from "./connection/Connection"; | ||
import App from "./module/app/App"; | ||
import BulkRequest from "./module/bulkRequest/BulkRequest"; | ||
import Record from "./module/record/Record"; | ||
import Auth from './authentication/Auth'; | ||
module.exports = { | ||
Record: require('./module/record/Record'), | ||
BulkRequest: require('./module/bulkRequest/BulkRequest'), | ||
App: require('./module/app/App'), | ||
Connection: require('./connection/Connection'), | ||
Auth: require('./authentication/Auth'), | ||
File: require('./module/file/File'), | ||
KintoneAPIException: require('./exception/KintoneAPIException'), | ||
RecordCursor: require('./module/cursor/RecordCursor') | ||
}; | ||
export { Record, BulkRequest, App, Connection, Auth, File, KintoneAPIException, RecordCursor }; |
@@ -79,6 +79,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = AddPreviewAppRequest; | ||
export default AddPreviewAppRequest; |
@@ -58,6 +58,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = DeployAppSettingsRequest; | ||
export default DeployAppSettingsRequest; |
@@ -44,2 +44,2 @@ /** | ||
} | ||
module.exports = GetAppDeployStatusRequest; | ||
export default GetAppDeployStatusRequest; |
@@ -43,2 +43,2 @@ /** | ||
} | ||
module.exports = GetAppRequest; | ||
export default GetAppRequest; |
@@ -76,6 +76,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetAppsRequest; | ||
export default GetAppsRequest; |
@@ -28,6 +28,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetGeneralSettingsRequest; | ||
export default GetGeneralSettingsRequest; |
@@ -28,6 +28,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetViewsRequest; | ||
export default GetViewsRequest; |
@@ -24,6 +24,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = UpdateGeneralSettingsRequest; | ||
export default UpdateGeneralSettingsRequest; |
@@ -31,6 +31,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = UpdateViewsRequest; | ||
export default UpdateViewsRequest; |
@@ -0,1 +1,16 @@ | ||
import UpdateGeneralSettingsRequest from "./app/UpdateGeneralSettingsRequest"; | ||
import GetGeneralSettingsRequest from "./app/GetGeneralSettingsRequest"; | ||
import UpdateViewsRequest from "./app/UpdateViewsRequest"; | ||
import GetViewsRequest from "./app/GetViewsRequest"; | ||
import GetAppDeployStatusRequest from "./app/GetAppDeployStatusRequest"; | ||
import DeployAppSettingsRequest from "./app/DeployAppSettingsRequest"; | ||
import AddPreviewAppRequest from "./app/AddPreviewAppRequest"; | ||
import UpdateFormLayoutRequest from "./form/UpdateFormLayoutRequest"; | ||
import GetFormLayoutsRequest from "./form/GetFormLayoutRequest"; | ||
import DeleteFormFieldsRequest from "./form/DeleteFormFieldsRequest"; | ||
import UpdateFormFieldsRequest from "./form/UpdateFormFieldsRequest"; | ||
import AddFormFieldsRequest from "./form/AddFormFieldsRequest"; | ||
import GetFormFieldsRequest from "./form/GetFormFieldsRequest"; | ||
import GetAppsRequest from "./app/GetAppsRequest"; | ||
import GetAppRequest from "./app/GetAppRequest"; | ||
/** | ||
@@ -7,18 +22,18 @@ * kintone api - nodejs client | ||
const AppModels = { | ||
GetAppRequest: require('./app/GetAppRequest'), | ||
GetAppsRequest: require('./app/GetAppsRequest'), | ||
GetFormFieldsRequest: require('./form/GetFormFieldsRequest'), | ||
AddFormFieldsRequest: require('./form/AddFormFieldsRequest'), | ||
UpdateFormFieldsRequest: require('./form/UpdateFormFieldsRequest'), | ||
DeleteFormFieldsRequest: require('./form/DeleteFormFieldsRequest'), | ||
GetFormLayoutsRequest: require('./form/GetFormLayoutRequest'), | ||
UpdateFormLayoutRequest: require('./form/UpdateFormLayoutRequest'), | ||
AddPreviewAppRequest: require('./app/AddPreviewAppRequest'), | ||
DeployAppSettingsRequest: require('./app/DeployAppSettingsRequest'), | ||
GetAppDeployStatusRequest: require('./app/GetAppDeployStatusRequest'), | ||
GetViewsRequest: require('./app/GetViewsRequest'), | ||
UpdateViewsRequest: require('./app/UpdateViewsRequest'), | ||
GetGeneralSettingsRequest: require('./app/GetGeneralSettingsRequest'), | ||
UpdateGeneralSettingsRequest: require('./app/UpdateGeneralSettingsRequest') | ||
GetAppRequest, | ||
GetAppsRequest, | ||
GetFormFieldsRequest, | ||
AddFormFieldsRequest, | ||
UpdateFormFieldsRequest, | ||
DeleteFormFieldsRequest, | ||
GetFormLayoutsRequest, | ||
UpdateFormLayoutRequest, | ||
AddPreviewAppRequest, | ||
DeployAppSettingsRequest, | ||
GetAppDeployStatusRequest, | ||
GetViewsRequest, | ||
UpdateViewsRequest, | ||
GetGeneralSettingsRequest, | ||
UpdateGeneralSettingsRequest | ||
}; | ||
module.exports = AppModels; | ||
export default AppModels; |
@@ -60,2 +60,2 @@ /** | ||
module.exports = constant(); | ||
export default constant(); |
@@ -31,6 +31,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = AddFormFieldsRequest; | ||
export default AddFormFieldsRequest; |
@@ -24,3 +24,2 @@ /** | ||
revision: this.revision | ||
}; | ||
@@ -33,6 +32,10 @@ return data; | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = DeleteFormFieldsRequest; | ||
export default DeleteFormFieldsRequest; |
@@ -30,6 +30,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetFormFieldsRequest; | ||
export default GetFormFieldsRequest; |
@@ -24,6 +24,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetFormLayoutRequest; | ||
export default GetFormLayoutRequest; |
@@ -31,6 +31,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = UpdateFormFieldsRequest; | ||
export default UpdateFormFieldsRequest; |
@@ -31,6 +31,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = UpdateFormLayoutRequest; | ||
export default UpdateFormLayoutRequest; |
@@ -24,6 +24,10 @@ /** | ||
*/ | ||
getPassword() { | ||
return this.password; | ||
} | ||
} | ||
module.exports = Credential; | ||
export default Credential; |
@@ -34,6 +34,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = BulkRequest; | ||
export default BulkRequest; |
@@ -30,6 +30,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = BulkRequestItem; | ||
export default BulkRequestItem; |
@@ -37,6 +37,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = CommentContent; | ||
export default CommentContent; |
@@ -28,6 +28,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = CommentMention; | ||
export default CommentMention; |
@@ -0,1 +1,3 @@ | ||
import CommentMention from "./CommentMention"; | ||
import CommentContent from "./CommentContent"; | ||
/** | ||
@@ -6,8 +8,6 @@ * kintone api - nodejs client | ||
module.exports = { | ||
// TODO: Write unit test | ||
CommentContent: require('./CommentContent'), | ||
// TODO: Write unit test | ||
CommentMention: require('./CommentMention'), | ||
// | ||
}; | ||
export default { | ||
CommentContent, | ||
CommentMention | ||
}; |
@@ -0,1 +1,4 @@ | ||
import DeleteRecordCursorRequest from "./recordCursor/DeleteCursorRequest"; | ||
import GetRecordCursorRequest from "./recordCursor/GetRecordCursorRequest"; | ||
import CreateRecordCursorRequest from "./recordCursor/CreateRecordCursorRequest"; | ||
/** | ||
@@ -6,7 +9,7 @@ * kintone api - nodejs client | ||
module.exports = { | ||
export default { | ||
// TODO: Write unit test | ||
CreateRecordCursorRequest: require('./recordCursor/CreateRecordCursorRequest'), | ||
GetRecordCursorRequest: require('./recordCursor/GetRecordCursorRequest'), | ||
DeleteRecordCursorRequest: require('./recordCursor/DeleteCursorRequest') | ||
CreateRecordCursorRequest, | ||
GetRecordCursorRequest, | ||
DeleteRecordCursorRequest | ||
}; |
@@ -72,6 +72,10 @@ /* eslint-disable no-async-promise-executor, require-atomic-updates */ | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = CreateRecordCursorRequest; | ||
export default CreateRecordCursorRequest; |
@@ -35,6 +35,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = DeleteCursorRequest; | ||
export default DeleteCursorRequest; |
@@ -35,6 +35,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetRecordCursorRequest; | ||
export default GetRecordCursorRequest; |
@@ -18,3 +18,2 @@ /** | ||
} | ||
/** | ||
@@ -89,6 +88,8 @@ * @param {Object} errors | ||
message: this.getMessage(), | ||
errors: this.getErrors() || '{}', | ||
errors: this.getErrors() || '{}' | ||
}; | ||
} | ||
} | ||
module.exports = ErrorResponse; | ||
export default ErrorResponse; |
@@ -22,6 +22,10 @@ /** | ||
*/ | ||
getErrorResponse() { | ||
return this.errorResponse; | ||
} | ||
} | ||
module.exports = KintoneAPIException; | ||
export default KintoneAPIException; |
@@ -0,1 +1,2 @@ | ||
import GetFileRequest from "./GetFileRequest"; | ||
/** | ||
@@ -6,5 +7,5 @@ * kintone api - nodejs client | ||
module.exports = { | ||
export default { | ||
// TODO: Write unit test | ||
GetFileRequest: require('./GetFileRequest'), | ||
GetFileRequest | ||
}; |
@@ -24,6 +24,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetFileRequest; | ||
export default GetFileRequest; |
@@ -24,6 +24,9 @@ /** | ||
*/ | ||
getValue() { | ||
return this.value; | ||
} | ||
} | ||
module.exports = HTTPHeader; | ||
export default HTTPHeader; |
@@ -14,2 +14,2 @@ /** | ||
module.exports = constant(); | ||
export default constant(); |
@@ -24,6 +24,9 @@ /** | ||
*/ | ||
getCode() { | ||
return this.code; | ||
} | ||
} | ||
module.exports = UserBase; | ||
export default UserBase; |
@@ -31,6 +31,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = AddCommentRequest; | ||
export default AddCommentRequest; |
@@ -31,6 +31,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = DeleteCommentRequest; | ||
export default DeleteCommentRequest; |
@@ -37,6 +37,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetCommentRequest; | ||
export default GetCommentRequest; |
@@ -46,6 +46,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = AddRecordRequest; | ||
export default AddRecordRequest; |
@@ -37,6 +37,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetRecordRequest; | ||
export default GetRecordRequest; |
@@ -1,6 +0,6 @@ | ||
const RecordUpdateKey = require('./RecordUpdateKey'); | ||
import RecordUpdateKey from "./RecordUpdateKey"; | ||
/** | ||
* RecordUpdateItem model | ||
*/ | ||
class RecordUpdateItem { | ||
@@ -75,6 +75,9 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = RecordUpdateItem; | ||
export default RecordUpdateItem; |
@@ -28,6 +28,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = RecordUpdateKey; | ||
export default RecordUpdateKey; |
@@ -34,6 +34,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = UpdateRecordAssigneesRequest; | ||
export default UpdateRecordAssigneesRequest; |
@@ -1,6 +0,6 @@ | ||
const RecordUpdateItem = require('./RecordUpdateItem'); | ||
import RecordUpdateItem from "./RecordUpdateItem"; | ||
/** | ||
* UpdateRecordRequest model | ||
*/ | ||
class UpdateRecordRequest extends RecordUpdateItem { | ||
@@ -29,6 +29,9 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = UpdateRecordRequest; | ||
export default UpdateRecordRequest; |
@@ -34,6 +34,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = UpdateRecordStatusItem; | ||
export default UpdateRecordStatusItem; |
@@ -1,6 +0,6 @@ | ||
const UpdateRecordStatusItem = require('./UpdateRecordStatusItem'); | ||
import UpdateRecordStatusItem from "./UpdateRecordStatusItem"; | ||
/** | ||
* UpdateRecordStatusRequest model | ||
*/ | ||
class UpdateRecordStatusRequest extends UpdateRecordStatusItem { | ||
@@ -32,6 +32,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = UpdateRecordStatusRequest; | ||
export default UpdateRecordStatusRequest; |
@@ -0,1 +1,17 @@ | ||
import AddCommentRequest from "./comment/AddCommentRequest"; | ||
import GetCommentsRequest from "./comments/GetCommentRequest"; | ||
import DeleteCommentRequest from "./comment/DeleteCommentRequest"; | ||
import RecordsUpdateKey from "./record/RecordUpdateKey"; | ||
import RecordsUpdateStatusItem from "./record/UpdateRecordStatusItem"; | ||
import RecordsUpdateItem from "./record/RecordUpdateItem"; | ||
import RecordUpdateStatusItem from "./record/UpdateRecordStatusItem"; | ||
import UpdateRecordAssigneesRequest from "./record/UpdateRecordAssigneesRequest"; | ||
import UpdateRecordStatusRequest from "./record/UpdateRecordStatusRequest"; | ||
import DeleteRecordsRequest from "./records/DeleteRecordsRequest"; | ||
import UpdateRecordsRequest from "./records/UpdateRecordsRequest"; | ||
import UpdateRecordRequest from "./record/UpdateRecordRequest"; | ||
import AddRecordsRequest from "./records/AddRecordsRequest"; | ||
import AddRecordRequest from "./record/AddRecordRequest"; | ||
import GetRecordsRequest from "./records/GetRecordsRequest"; | ||
import GetRecordRequest from "./record/GetRecordRequest"; | ||
/** | ||
@@ -5,44 +21,39 @@ * kintone api - nodejs client | ||
*/ | ||
// TODO, | ||
module.exports = { | ||
export default { | ||
// TODO: Write unit test | ||
GetRecordRequest: require('./record/GetRecordRequest'), | ||
GetRecordRequest, | ||
// TODO: Write unit test | ||
GetRecordsRequest: require('./records/GetRecordsRequest'), | ||
GetRecordsRequest, | ||
// TODO: Write unit test | ||
AddRecordRequest: require('./record/AddRecordRequest'), | ||
AddRecordRequest, | ||
// TODO: Write unit test | ||
AddRecordsRequest: require('./records/AddRecordsRequest'), | ||
AddRecordsRequest, | ||
// TODO: Write unit test | ||
UpdateRecordRequest: require('./record/UpdateRecordRequest'), | ||
UpdateRecordRequest, | ||
// TODO: Write unit test | ||
UpdateRecordsRequest: require('./records/UpdateRecordsRequest'), | ||
UpdateRecordsRequest, | ||
// TODO: Write unit test | ||
DeleteRecordsRequest: require('./records/DeleteRecordsRequest'), | ||
DeleteRecordsRequest, | ||
// TODO: Write unit test | ||
UpdateRecordStatusRequest: require('./record/UpdateRecordStatusRequest'), | ||
UpdateRecordStatusRequest, | ||
// TODO: Write unit test | ||
// TODO: Write unit test | ||
UpdateRecordAssigneesRequest: require('./record/UpdateRecordAssigneesRequest'), | ||
UpdateRecordAssigneesRequest, | ||
// TODO: Write unit test | ||
RecordUpdateStatusItem: require('./record/UpdateRecordStatusItem'), | ||
RecordUpdateStatusItem, | ||
// TODO: Write unit test | ||
RecordsUpdateItem: require('./record/RecordUpdateItem'), | ||
RecordsUpdateItem, | ||
// TODO: Write unit test | ||
RecordsUpdateStatusItem: require('./record/UpdateRecordStatusItem'), | ||
RecordsUpdateStatusItem, | ||
// TODO: Write unit test | ||
RecordsUpdateKey: require('./record/RecordUpdateKey'), | ||
RecordsUpdateKey, | ||
// TODO: Write unit test | ||
DeleteCommentRequest: require('./comment/DeleteCommentRequest'), | ||
DeleteCommentRequest, | ||
// TODO: Write unit test | ||
GetCommentsRequest: require('./comments/GetCommentRequest'), | ||
GetCommentsRequest, | ||
// TODO: Write unit test | ||
AddCommentRequest: require('./comment/AddCommentRequest'), | ||
AddCommentRequest | ||
}; |
@@ -58,6 +58,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = AddRecordsRequest; | ||
export default AddRecordsRequest; |
@@ -59,6 +59,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = DeleteRecordsRequest; | ||
export default DeleteRecordsRequest; |
@@ -33,6 +33,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = GetRecordsRequest; | ||
export default GetRecordsRequest; |
@@ -31,6 +31,10 @@ /** | ||
*/ | ||
toJSONString() { | ||
return JSON.stringify(this.toJSON()); | ||
} | ||
} | ||
module.exports = UpdateRecordsRequest; | ||
export default UpdateRecordsRequest; |
@@ -1,13 +0,12 @@ | ||
const Connection = require('../../connection/Connection'); | ||
const AppModel = require('../../model/app/AppModels'); | ||
const common = require('../../utils/Common'); | ||
import common from "../../utils/Common"; | ||
import AppModel from "../../model/app/AppModels"; | ||
import Connection from "../../connection/Connection"; | ||
/** | ||
* App module | ||
*/ | ||
class App { | ||
/** | ||
* The constructor for this module | ||
* @param {Object} params | ||
* @param {Connection} params.connection | ||
* The constructor for this module | ||
* @param {Connection} connection | ||
*/ | ||
@@ -274,2 +273,2 @@ constructor({connection} = {}) { | ||
} | ||
module.exports = App; | ||
export default App; |
@@ -1,7 +0,8 @@ | ||
const KintoneAPIException = require('../../exception/KintoneAPIException'); | ||
const Connection = require('../../connection/Connection'); | ||
const BulkRequestModel = require('../../model/bulkRequest/BulkRequest'); | ||
const BulkRequestItemModel = require('../../model/bulkRequest/BulkRequestItem'); | ||
const RecordModel = require('../../model/record/RecordModels'); | ||
import RecordModel from "../../model/record/RecordModels"; | ||
import BulkRequestItemModel from "../../model/bulkRequest/BulkRequestItem"; | ||
import BulkRequestModel from "../../model/bulkRequest/BulkRequest"; | ||
import Connection from "../../connection/Connection"; | ||
import KintoneAPIException from "../../exception/KintoneAPIException"; | ||
/** | ||
@@ -185,3 +186,2 @@ * BulkRequest module | ||
} | ||
/** | ||
@@ -220,6 +220,8 @@ * Execute the BulkRequest and get data which is returned from kintone. | ||
} | ||
return formatErrors; | ||
} | ||
} | ||
} | ||
module.exports = BulkRequest; | ||
export default BulkRequest; |
@@ -0,9 +1,11 @@ | ||
import KintoneAPIException from "../../model/exception/KintoneAPIException"; | ||
import CursorModel from "../../model/cursor/CursorModels"; | ||
import common from "../../utils/Common"; | ||
import Connection from "../../connection/Connection"; | ||
/* eslint-disable no-loop-func */ | ||
/* eslint-disable no-async-promise-executor, require-atomic-updates */ | ||
require('@babel/polyfill'); | ||
const Connection = require('../../connection/Connection'); | ||
const common = require('../../utils/Common'); | ||
const CursorModel = require('../../model/cursor/CursorModels'); | ||
const KintoneAPIException = require('../../model/exception/KintoneAPIException'); | ||
import '@babel/polyfill'; | ||
/** | ||
@@ -110,4 +112,5 @@ * RecordCursor module | ||
} | ||
} | ||
module.exports = RecordCursor; | ||
export default RecordCursor; |
@@ -1,3 +0,3 @@ | ||
const Connection = require('../../connection/Connection'); | ||
const FileModel = require('../../model/file/FileModels'); | ||
import FileModel from "../../model/file/FileModels"; | ||
import Connection from "../../connection/Connection"; | ||
@@ -41,2 +41,2 @@ /** | ||
} | ||
module.exports = File; | ||
export default File; |
@@ -0,7 +1,7 @@ | ||
import common from "../../utils/Common"; | ||
import RecordCursor from "../../module/cursor/RecordCursor"; | ||
import BulkRequest from "../../module/bulkRequest/BulkRequest"; | ||
import RecordModel from "../../model/record/RecordModels"; | ||
import Connection from "../../connection/Connection"; | ||
/* eslint-disable no-async-promise-executor, require-atomic-updates */ | ||
const Connection = require('../../connection/Connection'); | ||
const RecordModel = require('../../model/record/RecordModels'); | ||
const BulkRequest = require('../../module/bulkRequest/BulkRequest'); | ||
const RecordCursor = require('../../module/cursor/RecordCursor'); | ||
const common = require('../../utils/Common'); | ||
@@ -99,13 +99,22 @@ const LIMIT_UPDATE_RECORD = 100; | ||
* @param {Boolean} params.totalCount | ||
* @param {Boolean} params.seek | ||
* @return {Promise} Promise | ||
*/ | ||
getAllRecordsByQuery({app, query, fields, totalCount} = {}) { | ||
return this.getAllRecordsByQueryRecursive(app, query, fields, totalCount, null, null); | ||
getAllRecordsByQuery({app, query, fields, totalCount, seek = false} = {}) { | ||
return this.getAllRecordsByQueryRecursive(app, query, fields, totalCount, null, null, seek); | ||
} | ||
getAllRecordsByQueryRecursive(app, query, fields, totalCount, offset, records) { | ||
getAllRecordsByQueryRecursive(app, query, fields, totalCount, lastCount, records, seek) { | ||
let allRecords = records || []; | ||
const offsetNum = offset || 0; | ||
let validQuery; | ||
let nextCountNum; | ||
const limit = LIMIT_RECORD; | ||
const validQuery = (query) ? `${query} limit ${limit} offset ${offsetNum}` : `limit ${limit} offset ${offsetNum}`; | ||
if (seek) { | ||
validQuery = this.createValidQueryForSeek(query, lastCount, limit); | ||
if (fields && fields.length > 0 && fields.indexOf('$id') <= -1) { | ||
fields.push('$id'); | ||
} | ||
} else { | ||
validQuery = this.createValidQueryForOffset(query, lastCount, limit); | ||
} | ||
const getRecordsRequest = new RecordModel.GetRecordsRequest(app, validQuery, fields, totalCount); | ||
@@ -120,6 +129,24 @@ return this.sendRequest('GET', 'records', getRecordsRequest).then((response) => { | ||
} | ||
return this.getAllRecordsByQueryRecursive(app, query, fields, totalCount, offsetNum + limit, allRecords); | ||
if (seek) { | ||
nextCountNum = response.records[limit - 1].$id.value; | ||
} else { | ||
nextCountNum = lastCount + limit; | ||
} | ||
return this.getAllRecordsByQueryRecursive(app, query, fields, totalCount, nextCountNum, allRecords, seek); | ||
}); | ||
} | ||
createValidQueryForOffset(query, offset, limit) { | ||
const offsetNum = offset || 0; | ||
return (query) ? `${query} limit ${limit} offset ${offsetNum}` : `limit ${limit} offset ${offsetNum}`; | ||
} | ||
createValidQueryForSeek(query, lastRecord, limit) { | ||
const lastRecordId = lastRecord || 0; | ||
return (query) | ||
? `$id > ${lastRecordId} and (${query}) order by $id asc limit ${limit}` | ||
: `$id > ${lastRecordId} order by $id asc limit ${limit}`; | ||
} | ||
/** | ||
@@ -149,3 +176,2 @@ * Add the record | ||
} | ||
/** | ||
@@ -210,3 +236,3 @@ * Add multi records | ||
const recordsPerRequest = records.slice(begin, end); | ||
bulkRequest.addRecords({app: app,records: recordsPerRequest}); | ||
bulkRequest.addRecords({app: app, records: recordsPerRequest}); | ||
} | ||
@@ -649,2 +675,2 @@ return bulkRequest.execute(); | ||
} | ||
module.exports = Record; | ||
export default Record; |
@@ -0,1 +1,2 @@ | ||
import KintoneAPIException from "../exception/KintoneAPIException"; | ||
/** | ||
@@ -5,3 +6,2 @@ * kintone api - nodejs client | ||
*/ | ||
const KintoneAPIException = require('../exception/KintoneAPIException'); | ||
@@ -28,2 +28,2 @@ class Common { | ||
module.exports = new Common(); | ||
export default new Common(); |
@@ -1,27 +0,7 @@ | ||
import {Connection} from './module/connection/Connection'; | ||
import {File} from './module/file/File'; | ||
import {App} from './module/app/App'; | ||
import {Record} from './module/record/Record'; | ||
import {BulkRequest} from './module/bulkRequest/BulkRequest'; | ||
import {RecordCursor} from './module/cursor/RecordCursor'; | ||
import {Auth, KintoneAPIException} from '../base/main'; | ||
window.kintoneJSSDK = { | ||
Auth, | ||
Connection, | ||
App, | ||
Record, | ||
BulkRequest, | ||
File, | ||
KintoneAPIException, | ||
RecordCursor | ||
}; | ||
export {Auth}; | ||
export {Connection}; | ||
export {App}; | ||
export {Record}; | ||
export {BulkRequest}; | ||
export {File}; | ||
export {KintoneAPIException}; | ||
export {RecordCursor}; | ||
export { Connection } from './module/connection/Connection'; | ||
export { File } from './module/file/File'; | ||
export { App } from './module/app/App'; | ||
export { Record } from './module/record/Record'; | ||
export { BulkRequest } from './module/bulkRequest/BulkRequest'; | ||
export { RecordCursor } from './module/cursor/RecordCursor'; | ||
export { Auth, KintoneAPIException } from '../base/main'; |
@@ -1,8 +0,7 @@ | ||
const fs = require('fs'); | ||
const BaseAuth = require('../../base/main').Auth; | ||
import { Auth as BaseAuth } from "../../base/main"; | ||
import fs from "fs"; | ||
/** | ||
* Authentication module | ||
*/ | ||
class Auth extends BaseAuth { | ||
@@ -45,3 +44,2 @@ constructor(basicAuth, passwordAuth, apiToken) { | ||
} | ||
/** | ||
@@ -64,2 +62,2 @@ * Get the client certificate data | ||
module.exports = Auth; | ||
export default Auth; |
@@ -0,12 +1,10 @@ | ||
import { KintoneAPIException as KintoneAPIException } from "../../base/main"; | ||
import { Connection as BaseConnection } from "../../base/main"; | ||
import CONNECTION_CONST from "./constant"; | ||
import https from "https"; | ||
import FormData from "form-data"; | ||
import tls from "tls"; | ||
import axios from "axios"; | ||
import tunnel from "tunnel"; | ||
/* eslint-disable node/no-extraneous-require */ | ||
const tunnel = require('tunnel'); | ||
const axios = require('axios'); | ||
const tls = require('tls'); | ||
const FormData = require('form-data'); | ||
const https = require('https'); | ||
const CONNECTION_CONST = require('./constant'); | ||
const BaseConnection = require('../../base/main').Connection; | ||
const KintoneAPIException = require('../../base/main').KintoneAPIException; | ||
const CONTENT_TYPE_KEY = 'Content-Type'; | ||
@@ -135,3 +133,3 @@ const FILE_RESPONSE_TYPE_KEY = 'responseType'; | ||
// Set request options | ||
const requestOptions = this.options; | ||
const requestOptions = this.copyObject(this.options); | ||
requestOptions.method = method; | ||
@@ -224,3 +222,5 @@ requestOptions.url = uri; | ||
} | ||
} | ||
module.exports = Connection; | ||
export default Connection; |
@@ -24,2 +24,2 @@ /** | ||
module.exports = constant(); | ||
export default constant(); |
@@ -5,8 +5,10 @@ /** | ||
*/ | ||
import Auth from "./authentication/Auth"; | ||
import File from './module/file/File'; | ||
import Connection from './connection/Connection'; | ||
import { App, Record, BulkRequest, KintoneAPIException, RecordCursor } from "../base/main"; | ||
const {App, Record, BulkRequest, KintoneAPIException, RecordCursor} = require('../base/main'); | ||
module.exports = { | ||
Auth: require('./authentication/Auth'), | ||
Connection: require('./connection/Connection'), | ||
export { | ||
Auth, | ||
Connection, | ||
App, | ||
@@ -16,4 +18,4 @@ Record, | ||
KintoneAPIException, | ||
File: require('./module/file/File'), | ||
File, | ||
RecordCursor | ||
}; |
@@ -7,9 +7,7 @@ /** | ||
'use-strict'; | ||
import { File as FileModule } from "../../../base/main"; | ||
import path from "path"; | ||
import fs from "fs"; | ||
import { Connection, KintoneAPIException } from "../../../base/main"; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const {Connection, KintoneAPIException} = require('../../../base/main'); | ||
const FileModule = require('../../../base/main').File; | ||
/** | ||
@@ -62,2 +60,2 @@ * File module for NodeJS | ||
} | ||
module.exports = File; | ||
export default File; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
59
321949
15
4735
3