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

@onfleet/node-onfleet

Package Overview
Dependencies
Maintainers
0
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onfleet/node-onfleet - npm Package Compare versions

Comparing version 1.3.4 to 1.3.5

lib/resources/CustomFields.js

5

CHANGELOG.md

@@ -9,2 +9,6 @@ # Changelog

## [1.3.5] - 2024-08-09
### Added
- Added Custom field support for node API wrapper
## [1.3.4] - 2024-05-17

@@ -128,2 +132,3 @@ ### Added

[Unreleased]: https://github.com/onfleet/node-onfleet/compare/v1.3.0...HEAD
[1.3.5]: https://github.com/onfleet/node-onfleet/compare/v1.3.4...v1.3.5
[1.3.4]: https://github.com/onfleet/node-onfleet/compare/v1.3.3...v1.3.4

@@ -130,0 +135,0 @@ [1.3.3]: https://github.com/onfleet/node-onfleet/compare/v1.3.2...v1.3.3

1

lib/onfleet.js

@@ -24,2 +24,3 @@ const DEFAULT_URL = 'https://onfleet.com';

resources.Webhooks = require('./resources/Webhooks');
resources.CustomFields = require('./resources/CustomFields');

@@ -26,0 +27,0 @@ /**

2

package.json
{
"name": "@onfleet/node-onfleet",
"version": "1.3.4",
"version": "1.3.5",
"description": "Onfleet's Node.js API Wrapper Package",

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

@@ -119,2 +119,3 @@ # Onfleet Node.js Wrapper

| [Workers](https://docs.onfleet.com/reference/workers) | get()<br />get(query)<br />get(id)<br />getByLocation(obj)<br />getSchedule(id)<br />getTasks(id) | create(obj)<br />setSchedule(id, obj)<br />matchMetadata(obj)<br />getDeliveryManifest(obj) | update(id, obj)<br />insertTask(id, obj) | deleteOne(id) |
| [Custom Fields](https://docs.onfleet.com/reference/task-custom-fields) | get(modelName) | create(obj) | update(obj) | delete(obj) |

@@ -121,0 +122,0 @@ #### Peticiones GET

@@ -122,2 +122,3 @@ # Onfleet Node.js Wrapper

| [Workers](https://docs.onfleet.com/reference#workers) | get()<br />get(query)<br />get(id)<br />getByLocation(obj)<br />getSchedule(id)<br />getTasks(id) | create(obj)<br />setSchedule(id, obj)<br />matchMetadata(obj)<br />getDeliveryManifest(obj) | update(id, obj)<br />insertTask(id, obj) | deleteOne(id) |
| [Custom Fields](https://docs.onfleet.com/reference/task-custom-fields) | get(modelName) | create(obj) | update(obj) | delete(obj) |

@@ -124,0 +125,0 @@ #### Demandes GET

@@ -119,2 +119,3 @@ # Onfleet Node.js Wrapper

| [Workers](https://docs.onfleet.com/reference#workers) | get()<br />get(query)<br />get(id)<br />getByLocation(obj)<br />getSchedule(id)<br />getTasks(id) | create(obj)<br />setSchedule(id, obj)<br />matchMetadata(obj)<br />getDeliveryManifest(obj) | update(id, obj)<br />insertTask(id, obj) | deleteOne(id) |
| [Custom Fields](https://docs.onfleet.com/reference/task-custom-fields) | get(modelName) | create(obj) | update(obj) | delete(obj) |

@@ -121,0 +122,0 @@ #### GET Requests

@@ -119,2 +119,3 @@ # Onfleet Node.js Wrapper

| [Workers](https://docs.onfleet.com/reference/workers) | get()<br />get(query)<br />get(id)<br />getByLocation(obj)<br />getSchedule(id)<br />getTasks(id) | create(obj)<br />setSchedule(id, obj)<br />matchMetadata(obj)<br />getDeliveryManifest(obj) | update(id, obj)<br />insertTask(id, obj) | deleteOne(id) |
| [Custom Fields](https://docs.onfleet.com/reference/task-custom-fields) | get(modelName) | create(obj) | update(obj) | delete(obj) |

@@ -121,0 +122,0 @@ #### GET 請求

@@ -227,2 +227,31 @@ module.exports = {

},
createCustomFields: 200,
getCustomFields: {
fields: [
{
"description": "this is a test",
"asArray": false,
"visibility": [
"admin",
"api",
"worker"
],
"editability": [
"admin",
"api"
],
"key": "test",
"name": "test",
"type": "single_line_text_field",
"contexts": [
{
"isRequired": false,
"conditions": [],
"name": "save"
}
],
"value": "order 123"
}
]
}
};

@@ -51,2 +51,30 @@ /* eslint-disable no-unused-vars */

const createCustomField = {
model: 'Task',
field: [{
"description": "this is a test",
"asArray": false,
"visibility": [
"admin",
"api",
"worker"
],
"editability": [
"admin",
"api"
],
"key": "test",
"name": "test",
"type": "single_line_text_field",
"contexts": [
{
"isRequired": false,
"conditions": [],
"name": "save"
}
],
"value": "order 123"
}]
}
chai.should();

@@ -164,2 +192,8 @@ chai.use(chaiAsPromised);

.reply(200, response.getManifestProvider);
nock(baseUrl)
.get((uri) => uri.includes('customFields'))
.reply(200, response.getCustomFields);
nock(baseUrl)
.post((uri) => uri.includes('customFields'))
.reply(200, response.createCustomFields);
});

@@ -281,2 +315,15 @@ it('Get function', () => {

});
it('Get custom fields', () => {
return onfleet.customfields.get()
.then((res) => {
expect(typeof res).to.equal('object');
assert.equal(res.fields.length, 1);
});
});
it('Create custom field', () => {
return onfleet.customfields.create(createCustomField)
.then((res) => {
assert.equal(res, 200);
});
});
});
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