@artaio/node-api 0.30.1 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/lib/ArtaClient.d.ts +5 -5
- package/dist/lib/ArtaClient.js +17 -4
- package/dist/lib/MetadataTypes.d.ts +1 -93
- package/dist/lib/MetadataTypes.js +15 -0
- package/dist/lib/arta.d.ts +1 -1
- package/dist/lib/arta.js +2 -2
- package/dist/lib/endpoint/attachment.d.ts +4 -10
- package/dist/lib/endpoint/emailRules.d.ts +6 -12
- package/dist/lib/endpoint/emailSubscriptions.d.ts +6 -12
- package/dist/lib/endpoint/endpoint.d.ts +5 -5
- package/dist/lib/endpoint/endpoint.js +3 -2
- package/dist/lib/endpoint/hostedSessions.d.ts +12 -29
- package/dist/lib/endpoint/invoicePayments.d.ts +7 -14
- package/dist/lib/endpoint/invoicePayments.js +13 -3
- package/dist/lib/endpoint/invoices.d.ts +4 -18
- package/dist/lib/endpoint/keys.d.ts +6 -16
- package/dist/lib/endpoint/logs.d.ts +7 -19
- package/dist/lib/endpoint/logs.js +12 -3
- package/dist/lib/endpoint/metadata.d.ts +3 -3
- package/dist/lib/endpoint/organization.d.ts +2 -14
- package/dist/lib/endpoint/payments.d.ts +7 -11
- package/dist/lib/endpoint/payments.js +13 -3
- package/dist/lib/endpoint/requests.d.ts +17 -41
- package/dist/lib/endpoint/requests.js +17 -5
- package/dist/lib/endpoint/shipments.d.ts +6 -73
- package/dist/lib/endpoint/shipments.js +19 -13
- package/dist/lib/endpoint/trackings.d.ts +3 -19
- package/dist/lib/endpoint/trackings.js +15 -6
- package/dist/lib/endpoint/uploads.d.ts +7 -18
- package/dist/lib/endpoint/webhookDeliveries.d.ts +4 -18
- package/dist/lib/endpoint/webhooks.d.ts +10 -13
- package/dist/lib/index.d.ts +9 -16
- package/dist/lib/net/FetchHttpClient.d.ts +13 -0
- package/dist/lib/net/FetchHttpClient.js +128 -0
- package/dist/lib/net/HttpClient.d.ts +6 -6
- package/dist/lib/net/RestClient.d.ts +3 -3
- package/dist/lib/types.d.ts +750 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/utils.d.ts +7 -2
- package/dist/lib/utils.js +16 -5
- package/dist/package.json +29 -21
- package/dist/schemas/generate.d.ts +1 -0
- package/dist/schemas/generate.js +51 -0
- package/dist/schemas/index.d.ts +3204 -0
- package/dist/schemas/index.js +733 -0
- package/dist/test-integration/index.d.ts +2 -0
- package/dist/test-integration/index.js +7 -0
- package/dist/test-integration/keys.test.d.ts +1 -0
- package/dist/test-integration/keys.test.js +71 -0
- package/dist/test-integration/requests.test.d.ts +1 -0
- package/dist/test-integration/requests.test.js +87 -0
- package/dist/test-integration/shipments.test.d.ts +1 -0
- package/dist/test-integration/shipments.test.js +114 -0
- package/package.json +29 -21
- package/dist/lib/net/NodeHttpClient.d.ts +0 -20
- package/dist/lib/net/NodeHttpClient.js +0 -203
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export interface DatedInterface {
|
|
2
2
|
updated_at?: Date;
|
|
3
|
-
created_at
|
|
3
|
+
created_at?: Date;
|
|
4
4
|
}
|
|
5
|
+
export interface UnparsedDatedInterface {
|
|
6
|
+
updated_at?: string;
|
|
7
|
+
created_at?: string;
|
|
8
|
+
}
|
|
9
|
+
export type NotDateParsed<T> = Omit<T, 'updated_at' | 'created_at'> & UnparsedDatedInterface;
|
|
5
10
|
export declare function createDateAsUTC(dateStr: string): Date;
|
|
6
|
-
export declare function convertDatesToUtc(artaResponse:
|
|
11
|
+
export declare function convertDatesToUtc<T extends DatedInterface>(artaResponse: NotDateParsed<T>): T;
|
|
7
12
|
export type Nullable<T> = T | null;
|
|
8
13
|
export type NullableString = Nullable<string>;
|
|
9
14
|
export declare const parseService: (s: any) => void;
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.parseService = exports.convertDatesToUtc = exports.createDateAsUTC = void 0;
|
|
4
15
|
function createDateAsUTC(dateStr) {
|
|
@@ -8,11 +19,11 @@ function createDateAsUTC(dateStr) {
|
|
|
8
19
|
}
|
|
9
20
|
exports.createDateAsUTC = createDateAsUTC;
|
|
10
21
|
function convertDatesToUtc(artaResponse) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
return __assign(__assign({}, artaResponse), { created_at: artaResponse.created_at
|
|
23
|
+
? createDateAsUTC(artaResponse.created_at)
|
|
24
|
+
: undefined, updated_at: artaResponse.updated_at
|
|
25
|
+
? createDateAsUTC(artaResponse.updated_at)
|
|
26
|
+
: undefined });
|
|
16
27
|
}
|
|
17
28
|
exports.convertDatesToUtc = convertDatesToUtc;
|
|
18
29
|
var parseService = function (s) {
|
package/dist/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artaio/node-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "The Arta Node library provides a seamless integration to Arta API for applications running on Node.js using both Typescript or Javascript.",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "tsc -p tsconfig-build.json",
|
|
7
|
-
"
|
|
6
|
+
"build": "npm run build:types && tsc -p tsconfig-build.json",
|
|
7
|
+
"build:types": "npx ts-node ./schemas/generate.ts > lib/types.ts",
|
|
8
|
+
"test": "npm run lint && npm run test:unit",
|
|
9
|
+
"test:unit": "jest --coverage --detectOpenHandles --verbose ./test/",
|
|
10
|
+
"test:integration": "jest --coverage --verbose --testTimeout 30000 ./test-integration/",
|
|
8
11
|
"lint": "eslint .",
|
|
9
12
|
"lint:fix": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
|
|
10
13
|
"postinstall": "husky install",
|
|
11
14
|
"prepublishOnly": "pinst --disable",
|
|
12
|
-
"postpublish": "pinst --enable"
|
|
15
|
+
"postpublish": "pinst --enable",
|
|
16
|
+
"prepare": "node -e \"try { (await import('husky')).default() } catch (e) { if (e.code !== 'ERR_MODULE_NOT_FOUND') throw e }\" --input-type module"
|
|
13
17
|
},
|
|
14
18
|
"types": "dist/lib/index.d.ts",
|
|
15
19
|
"module": "dist/lib/index.js",
|
|
@@ -31,28 +35,32 @@
|
|
|
31
35
|
"Selman Uysal <selman@arta.io>"
|
|
32
36
|
],
|
|
33
37
|
"devDependencies": {
|
|
34
|
-
"@commitlint/cli": "^
|
|
35
|
-
"@commitlint/config-conventional": "^
|
|
36
|
-
"@types/jest": "^29.5.
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"eslint": "^
|
|
42
|
-
"eslint-
|
|
43
|
-
"eslint-plugin-import": "^2.27.5",
|
|
44
|
-
"eslint-plugin-n": "^16.0.0",
|
|
38
|
+
"@commitlint/cli": "^18.2.0",
|
|
39
|
+
"@commitlint/config-conventional": "^18.1.0",
|
|
40
|
+
"@types/jest": "^29.5.7",
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
|
42
|
+
"@typescript-eslint/parser": "^6.9.1",
|
|
43
|
+
"eslint": "^8.52.0",
|
|
44
|
+
"eslint-config-prettier": "^9.0.0",
|
|
45
|
+
"eslint-plugin-import": "^2.29.0",
|
|
46
|
+
"eslint-plugin-n": "^16.2.0",
|
|
45
47
|
"eslint-plugin-promise": "^6.1.1",
|
|
46
|
-
"husky": "^
|
|
47
|
-
"jest": "^29.
|
|
48
|
-
"nock": "^
|
|
48
|
+
"husky": "^9.0.11",
|
|
49
|
+
"jest": "^29.7.0",
|
|
50
|
+
"nock": "^14.0.0-beta.5",
|
|
49
51
|
"pinst": "^3.0.0",
|
|
50
|
-
"prettier": "
|
|
51
|
-
"ts-jest": "^29.1.
|
|
52
|
-
"
|
|
52
|
+
"prettier": "3.0.3",
|
|
53
|
+
"ts-jest": "^29.1.1",
|
|
54
|
+
"ts-node": "^10.9.2",
|
|
55
|
+
"typescript": "^5.2.2",
|
|
56
|
+
"zod": "^3.22.4",
|
|
57
|
+
"zod-to-ts": "^1.2.0"
|
|
53
58
|
},
|
|
54
59
|
"bugs": {
|
|
55
60
|
"url": "https://github.com/artaio/arta-node-api/issues"
|
|
56
61
|
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=18.x"
|
|
64
|
+
},
|
|
57
65
|
"license": "MIT"
|
|
58
66
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var zod_to_ts_1 = require("zod-to-ts");
|
|
4
|
+
var _1 = require(".");
|
|
5
|
+
var generate = function (schema, identifier) {
|
|
6
|
+
var node = (0, zod_to_ts_1.zodToTs)(schema, identifier).node;
|
|
7
|
+
var typeAlias = (0, zod_to_ts_1.createTypeAlias)(node, identifier);
|
|
8
|
+
console.log('export ' + (0, zod_to_ts_1.printNode)(typeAlias));
|
|
9
|
+
};
|
|
10
|
+
generate(_1.attatchmentSchema, 'Attachment');
|
|
11
|
+
generate(_1.requestSchema, 'QuoteRequest');
|
|
12
|
+
generate(_1.keySchema, 'Key');
|
|
13
|
+
generate(_1.shipmentSchema, 'Shipment');
|
|
14
|
+
generate(_1.emailRuleSchema, 'EmailRule');
|
|
15
|
+
generate(_1.emailSubscriptionSchema, 'EmailSubscription');
|
|
16
|
+
generate(_1.hostedSessionSchema, 'HostedSession');
|
|
17
|
+
generate(_1.invoicePaymentSchema, 'InvoicePayment');
|
|
18
|
+
generate(_1.invoiceSchema, 'Invoice');
|
|
19
|
+
generate(_1.logSchema, 'Log');
|
|
20
|
+
generate(_1.organizationSchema, 'Organization');
|
|
21
|
+
generate(_1.paymentSchema, 'Payment');
|
|
22
|
+
generate(_1.carrierSchema, 'Carrier');
|
|
23
|
+
generate(_1.trackingEventSchema, 'TrackingEvent');
|
|
24
|
+
generate(_1.trackingSchema, 'Tracking');
|
|
25
|
+
generate(_1.uploadSchema, 'Upload');
|
|
26
|
+
generate(_1.webhookDeliverySchema, 'WebhookDelivery');
|
|
27
|
+
generate(_1.webhookSchema, 'Webhook');
|
|
28
|
+
generate(_1.artaServiceSchema, 'ArtaService');
|
|
29
|
+
generate(_1.disqualificationSchema, 'Disqualification');
|
|
30
|
+
generate(_1.detailsSchema, 'Detail');
|
|
31
|
+
generate(_1.additionalServiceSchema, 'AdditionalService');
|
|
32
|
+
generate(_1.supportedCurrencySchema, 'SupportedCurrency');
|
|
33
|
+
generate(_1.artaLocationSchema, 'ArtaLocation');
|
|
34
|
+
generate(_1.insuranceSchema, 'Insurance');
|
|
35
|
+
generate(_1.artaObjectSchema, 'ArtaObject');
|
|
36
|
+
generate(_1.quoteTypeSchema, 'QuoteType');
|
|
37
|
+
generate(_1.contactSchema, 'Contact');
|
|
38
|
+
generate(_1.shipmentExceptionStatusSchema, 'ShipmentExceptionStatus');
|
|
39
|
+
generate(_1.packageStatusSechema, 'PackageStatus');
|
|
40
|
+
generate(_1.packageSchema, 'Package');
|
|
41
|
+
generate(_1.shipmentExceptionTypeIdSchema, 'ShipmentExceptionTypeId');
|
|
42
|
+
generate(_1.shipmentExceptionSchema, 'ShipmentException');
|
|
43
|
+
generate(_1.shipmentScheduleSchema, 'ShipmentSchedule');
|
|
44
|
+
generate(_1.shipmentTrackingSchema, 'ShipmentTracking');
|
|
45
|
+
generate(_1.insurancePolicySchema, 'InsurancePolicy');
|
|
46
|
+
generate(_1.quoteSchema, 'Quote');
|
|
47
|
+
generate(_1.requestListItemSchema, 'QuoteRequestListItem');
|
|
48
|
+
generate(_1.emailNotificationIdSchema, 'EmailNotificationId');
|
|
49
|
+
generate(_1.recipientSchema, 'Recipient');
|
|
50
|
+
generate(_1.mimeTypeSchema, 'ArtaMimeType');
|
|
51
|
+
generate(_1.documentTypeSchema, 'ArtaDocumentType');
|