@aptly-as/types 2.7.14 → 2.8.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/enums/document.d.ts +1 -0
- package/enums/document.js +1 -0
- package/enums/index.d.ts +0 -5
- package/enums/index.js +0 -6
- package/enums/webhook.d.ts +1 -0
- package/enums/webhook.js +1 -0
- package/error/error.d.ts +10 -6
- package/error/error.js +15 -10
- package/error/error.utils.d.ts +5 -0
- package/error/error.utils.js +6 -0
- package/error/index.d.ts +1 -0
- package/error/index.js +1 -0
- package/models/payment.d.ts +1 -0
- package/models/unit.d.ts +4 -0
- package/package.json +1 -1
package/enums/document.d.ts
CHANGED
package/enums/document.js
CHANGED
|
@@ -27,6 +27,7 @@ export var AptlyDocumentType;
|
|
|
27
27
|
AptlyDocumentType["Prospect"] = "prospect";
|
|
28
28
|
AptlyDocumentType["Public"] = "public";
|
|
29
29
|
AptlyDocumentType["Receipt"] = "receipt";
|
|
30
|
+
AptlyDocumentType["Report"] = "report";
|
|
30
31
|
AptlyDocumentType["RiskAssessment"] = "risk-assessment";
|
|
31
32
|
AptlyDocumentType["SignedReceipt"] = "signedReceipt";
|
|
32
33
|
AptlyDocumentType["VVSDrawing"] = "vvsDrawing";
|
package/enums/index.d.ts
CHANGED
|
@@ -83,11 +83,6 @@ export declare enum AptlySignageSignerRef {
|
|
|
83
83
|
Customer = "customer",
|
|
84
84
|
Admin = "admin"
|
|
85
85
|
}
|
|
86
|
-
export declare enum AptlyErrorCode {
|
|
87
|
-
Default = "default",
|
|
88
|
-
InvalidFields = "invalid-fields",
|
|
89
|
-
SessionExpired = "session-expired"
|
|
90
|
-
}
|
|
91
86
|
export declare enum AptlyQueueDownloadType {
|
|
92
87
|
Document = "document",
|
|
93
88
|
Image = "image"
|
package/enums/index.js
CHANGED
|
@@ -95,12 +95,6 @@ export var AptlySignageSignerRef;
|
|
|
95
95
|
AptlySignageSignerRef["Customer"] = "customer";
|
|
96
96
|
AptlySignageSignerRef["Admin"] = "admin";
|
|
97
97
|
})(AptlySignageSignerRef || (AptlySignageSignerRef = {}));
|
|
98
|
-
export var AptlyErrorCode;
|
|
99
|
-
(function (AptlyErrorCode) {
|
|
100
|
-
AptlyErrorCode["Default"] = "default";
|
|
101
|
-
AptlyErrorCode["InvalidFields"] = "invalid-fields";
|
|
102
|
-
AptlyErrorCode["SessionExpired"] = "session-expired";
|
|
103
|
-
})(AptlyErrorCode || (AptlyErrorCode = {}));
|
|
104
98
|
export var AptlyQueueDownloadType;
|
|
105
99
|
(function (AptlyQueueDownloadType) {
|
|
106
100
|
AptlyQueueDownloadType["Document"] = "document";
|
package/enums/webhook.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare enum AptlyWebhookType {
|
|
|
10
10
|
UnitPaymentCreated = "aptly.unit.payment.created",
|
|
11
11
|
UnitPaymentCaptured = "aptly.unit.payment.captured",
|
|
12
12
|
UnitPaymentReceipt = "aptly.unit.payment.receipt",
|
|
13
|
+
UnitPaymentReport = "aptly.unit.payment.report",
|
|
13
14
|
UnitReportFinal = "aptly.unit.report.final",
|
|
14
15
|
OrganizationAppUpdated = "aptly.organization.app.updated",
|
|
15
16
|
OrganizationAppDeleted = "aptly.organization.app.deleted"
|
package/enums/webhook.js
CHANGED
|
@@ -11,6 +11,7 @@ export var AptlyWebhookType;
|
|
|
11
11
|
AptlyWebhookType["UnitPaymentCreated"] = "aptly.unit.payment.created";
|
|
12
12
|
AptlyWebhookType["UnitPaymentCaptured"] = "aptly.unit.payment.captured";
|
|
13
13
|
AptlyWebhookType["UnitPaymentReceipt"] = "aptly.unit.payment.receipt";
|
|
14
|
+
AptlyWebhookType["UnitPaymentReport"] = "aptly.unit.payment.report";
|
|
14
15
|
AptlyWebhookType["UnitReportFinal"] = "aptly.unit.report.final";
|
|
15
16
|
AptlyWebhookType["OrganizationAppUpdated"] = "aptly.organization.app.updated";
|
|
16
17
|
AptlyWebhookType["OrganizationAppDeleted"] = "aptly.organization.app.deleted";
|
package/error/error.d.ts
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
|
+
import { AptlyErrorCode } from './error.utils.js';
|
|
1
2
|
export interface AptlyErrorBody {
|
|
2
3
|
name: 'AptlyError';
|
|
3
4
|
status: number;
|
|
4
|
-
|
|
5
|
+
message: string;
|
|
5
6
|
id?: string;
|
|
6
|
-
code?:
|
|
7
|
+
code?: AptlyErrorCode;
|
|
7
8
|
detail?: string;
|
|
8
9
|
errors?: AptlyErrorBodySimple[];
|
|
9
10
|
link?: string;
|
|
11
|
+
title?: string;
|
|
10
12
|
error?: string;
|
|
11
13
|
}
|
|
12
|
-
export type AptlyErrorBodySimple = Pick<AptlyErrorBody, 'status' | '
|
|
14
|
+
export type AptlyErrorBodySimple = Pick<AptlyErrorBody, 'status' | 'message' | 'detail' | 'link'>;
|
|
13
15
|
export declare class AptlyError extends Error {
|
|
14
16
|
readonly data: Omit<AptlyErrorBody, 'name'>;
|
|
15
17
|
readonly error?: Error | undefined;
|
|
16
18
|
readonly name = "AptlyError";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
readonly _status: number;
|
|
20
|
+
readonly id: string;
|
|
19
21
|
static fromFetchResponse(response: Response): Promise<AptlyError>;
|
|
22
|
+
static fromResponse(response: Response): Promise<AptlyError>;
|
|
23
|
+
constructor(data: Omit<AptlyErrorBody, 'name'>, error?: Error | undefined);
|
|
20
24
|
get status(): number;
|
|
21
25
|
get title(): string;
|
|
22
|
-
get code():
|
|
26
|
+
get code(): AptlyErrorCode | undefined;
|
|
23
27
|
get detail(): string | undefined;
|
|
24
28
|
get link(): string | undefined;
|
|
25
29
|
get errors(): AptlyErrorBodySimple[];
|
package/error/error.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
export class AptlyError extends Error {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
this.data = data;
|
|
5
|
-
this.error = error;
|
|
6
|
-
this.name = 'AptlyError';
|
|
7
|
-
this.id = data.id || '';
|
|
2
|
+
static fromFetchResponse(response) {
|
|
3
|
+
return AptlyError.fromResponse(response);
|
|
8
4
|
}
|
|
9
|
-
static async
|
|
5
|
+
static async fromResponse(response) {
|
|
10
6
|
if (response.headers.get('content-type') !== 'application/json') {
|
|
11
7
|
const body = await response.json();
|
|
12
8
|
if (body.name === AptlyError.name) {
|
|
@@ -16,15 +12,24 @@ export class AptlyError extends Error {
|
|
|
16
12
|
throw new AptlyError({
|
|
17
13
|
id: 'unknown',
|
|
18
14
|
status: response.status,
|
|
19
|
-
|
|
15
|
+
message: response.statusText,
|
|
20
16
|
detail: `Failed to fetch from url: ${response.url}`,
|
|
21
17
|
});
|
|
22
18
|
}
|
|
19
|
+
constructor(data, error) {
|
|
20
|
+
super(data.title || data.message);
|
|
21
|
+
this.data = data;
|
|
22
|
+
this.error = error;
|
|
23
|
+
this.name = 'AptlyError';
|
|
24
|
+
this._status = 500;
|
|
25
|
+
this._status = data.status;
|
|
26
|
+
this.id = data.id || '';
|
|
27
|
+
}
|
|
23
28
|
get status() {
|
|
24
|
-
return this.
|
|
29
|
+
return this._status;
|
|
25
30
|
}
|
|
26
31
|
get title() {
|
|
27
|
-
return this.data.
|
|
32
|
+
return this.data.message;
|
|
28
33
|
}
|
|
29
34
|
get code() {
|
|
30
35
|
return this.data.code;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var AptlyErrorCode;
|
|
2
|
+
(function (AptlyErrorCode) {
|
|
3
|
+
AptlyErrorCode[AptlyErrorCode["NotFound"] = 4040] = "NotFound";
|
|
4
|
+
AptlyErrorCode[AptlyErrorCode["Duplicate"] = 4090] = "Duplicate";
|
|
5
|
+
AptlyErrorCode[AptlyErrorCode["Error"] = 5000] = "Error";
|
|
6
|
+
})(AptlyErrorCode || (AptlyErrorCode = {}));
|
package/error/index.d.ts
CHANGED
package/error/index.js
CHANGED
package/models/payment.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface AptlyPaymentSchema<ID, DATE> extends Omit<AptlyBaseSchema<ID, D
|
|
|
14
14
|
order: ID | AptlyOrderSchema<ID, DATE>;
|
|
15
15
|
app: ID | AptlyAppSchema<ID, DATE>;
|
|
16
16
|
document?: ID | AptlyDocumentSchema<ID, DATE>;
|
|
17
|
+
reportDocument?: ID | AptlyDocumentSchema<ID, DATE>;
|
|
17
18
|
status: AptlyPaymentStatus;
|
|
18
19
|
number: number;
|
|
19
20
|
totalCost: number;
|
package/models/unit.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AptlyDocumentSchema } from './document.js';
|
|
2
2
|
import { AptlyOrderSchema } from './order.js';
|
|
3
|
+
import { AptlyPeriodSchema } from './period.js';
|
|
3
4
|
import { AptlyProducerSchema } from './producer.js';
|
|
4
5
|
import { AptlyProductSchema } from './product.js';
|
|
5
6
|
import { AptlyProjectSchema } from './project.js';
|
|
@@ -103,6 +104,7 @@ export interface AptlyUnitOptionItemSchema<ID, DATE> extends AptlyUnitSelectedOp
|
|
|
103
104
|
unitCost: number;
|
|
104
105
|
unitVat?: number;
|
|
105
106
|
pickRef?: ID;
|
|
107
|
+
order?: ID;
|
|
106
108
|
}
|
|
107
109
|
export type AptlyUnitOptionExtraItem = AptlyUnitOptionExtraItemSchema<string, string>;
|
|
108
110
|
export interface AptlyUnitOptionExtraItemSchema<ID, DATE> extends AptlyUnitOptionItemSchema<ID, DATE> {
|
|
@@ -247,4 +249,6 @@ export interface AptlyUnitInviteSchema<ID, DATE> {
|
|
|
247
249
|
claimTime?: DATE;
|
|
248
250
|
};
|
|
249
251
|
}
|
|
252
|
+
export type AptlyUnitPeriod = AptlyUnitPeriodSchema<string, string>;
|
|
253
|
+
export type AptlyUnitPeriodSchema<ID, DATE> = AptlyPeriodSchema<ID, DATE> & Pick<AptlyUnitConfirmedPeriodSchema<ID, DATE>, 'confirmed' | 'order'>;
|
|
250
254
|
export {};
|