aerochain-node-sdk 1.0.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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +216 -0
  3. package/dist/auth.d.ts +26 -0
  4. package/dist/auth.d.ts.map +1 -0
  5. package/dist/auth.js +93 -0
  6. package/dist/client.d.ts +41 -0
  7. package/dist/client.d.ts.map +1 -0
  8. package/dist/client.js +44 -0
  9. package/dist/clients/aircraft-events.d.ts +15 -0
  10. package/dist/clients/aircraft-events.d.ts.map +1 -0
  11. package/dist/clients/aircraft-events.js +21 -0
  12. package/dist/clients/aircraft-models.d.ts +14 -0
  13. package/dist/clients/aircraft-models.d.ts.map +1 -0
  14. package/dist/clients/aircraft-models.js +17 -0
  15. package/dist/clients/aircraft.d.ts +15 -0
  16. package/dist/clients/aircraft.d.ts.map +1 -0
  17. package/dist/clients/aircraft.js +19 -0
  18. package/dist/clients/ata-chapters.d.ts +14 -0
  19. package/dist/clients/ata-chapters.d.ts.map +1 -0
  20. package/dist/clients/ata-chapters.js +15 -0
  21. package/dist/clients/dashboard.d.ts +8 -0
  22. package/dist/clients/dashboard.d.ts.map +1 -0
  23. package/dist/clients/dashboard.js +9 -0
  24. package/dist/clients/documents.d.ts +14 -0
  25. package/dist/clients/documents.d.ts.map +1 -0
  26. package/dist/clients/documents.js +15 -0
  27. package/dist/clients/event-shares.d.ts +31 -0
  28. package/dist/clients/event-shares.d.ts.map +1 -0
  29. package/dist/clients/event-shares.js +36 -0
  30. package/dist/clients/organizations.d.ts +14 -0
  31. package/dist/clients/organizations.d.ts.map +1 -0
  32. package/dist/clients/organizations.js +17 -0
  33. package/dist/clients/part-events.d.ts +27 -0
  34. package/dist/clients/part-events.d.ts.map +1 -0
  35. package/dist/clients/part-events.js +31 -0
  36. package/dist/clients/part-models.d.ts +15 -0
  37. package/dist/clients/part-models.d.ts.map +1 -0
  38. package/dist/clients/part-models.js +19 -0
  39. package/dist/clients/partnerships.d.ts +20 -0
  40. package/dist/clients/partnerships.d.ts.map +1 -0
  41. package/dist/clients/partnerships.js +22 -0
  42. package/dist/clients/parts.d.ts +29 -0
  43. package/dist/clients/parts.d.ts.map +1 -0
  44. package/dist/clients/parts.js +42 -0
  45. package/dist/clients/registry.d.ts +11 -0
  46. package/dist/clients/registry.d.ts.map +1 -0
  47. package/dist/clients/registry.js +11 -0
  48. package/dist/clients/users.d.ts +8 -0
  49. package/dist/clients/users.d.ts.map +1 -0
  50. package/dist/clients/users.js +9 -0
  51. package/dist/http-client.d.ts +8 -0
  52. package/dist/http-client.d.ts.map +1 -0
  53. package/dist/http-client.js +63 -0
  54. package/dist/index.d.ts +7 -0
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/index.js +2 -0
  57. package/dist/types.d.ts +351 -0
  58. package/dist/types.d.ts.map +1 -0
  59. package/dist/types.js +1 -0
  60. package/package.json +64 -0
@@ -0,0 +1,15 @@
1
+ import { formatApiParams } from '../http-client.js';
2
+ export class DocumentsClient {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async list(options) {
7
+ const params = formatApiParams(options?.page, options?.filters);
8
+ const response = await this.http.get('/documents', { params });
9
+ return response.data;
10
+ }
11
+ async get(id) {
12
+ const response = await this.http.get(`/documents/${id}`);
13
+ return response.data;
14
+ }
15
+ }
@@ -0,0 +1,31 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { EventShare, CreateEventSharePayload } from '../types.js';
3
+ export type EventSharesListOptions = {
4
+ entityType?: 'part' | 'aircraft';
5
+ status?: 'pending' | 'accepted' | 'declined' | 'revoked' | 'cancelled';
6
+ direction?: 'received' | 'sent';
7
+ filters?: {
8
+ [key: string]: any;
9
+ };
10
+ };
11
+ export declare class EventSharesClient {
12
+ private http;
13
+ constructor(http: AxiosInstance);
14
+ list(options?: EventSharesListOptions): Promise<EventShare[]>;
15
+ create(payload: CreateEventSharePayload): Promise<EventShare>;
16
+ createBulk(payload: {
17
+ eventShares: CreateEventSharePayload[];
18
+ }): Promise<{
19
+ created: number;
20
+ errors: number;
21
+ shares: EventShare[];
22
+ errorDetails: Array<{
23
+ eventShare: CreateEventSharePayload;
24
+ error: string;
25
+ }>;
26
+ }>;
27
+ accept(shareId: string): Promise<EventShare>;
28
+ decline(shareId: string): Promise<EventShare>;
29
+ cancel(shareId: string): Promise<EventShare>;
30
+ }
31
+ //# sourceMappingURL=event-shares.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-shares.d.ts","sourceRoot":"","sources":["../../src/clients/event-shares.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAElE,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACjC,MAAM,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;IACvE,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CAClC,CAAC;AAEF,qBAAa,iBAAiB;IAChB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEjC,IAAI,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAW7D,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC;IAK7D,UAAU,CAAC,OAAO,EAAE;QAAE,WAAW,EAAE,uBAAuB,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC;QAC7E,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,UAAU,EAAE,CAAC;QACrB,YAAY,EAAE,KAAK,CAAC;YAAE,UAAU,EAAE,uBAAuB,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC7E,CAAC;IAKI,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAK5C,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAK7C,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAInD"}
@@ -0,0 +1,36 @@
1
+ export class EventSharesClient {
2
+ constructor(http) {
3
+ this.http = http;
4
+ }
5
+ async list(options) {
6
+ const params = { ...options?.filters };
7
+ if (options?.entityType)
8
+ params.entityType = options.entityType;
9
+ if (options?.status)
10
+ params.status = options.status;
11
+ if (options?.direction)
12
+ params.direction = options.direction;
13
+ const response = await this.http.get('/event_shares', { params });
14
+ return response.data.member;
15
+ }
16
+ async create(payload) {
17
+ const response = await this.http.post('/event_shares', payload);
18
+ return response.data;
19
+ }
20
+ async createBulk(payload) {
21
+ const response = await this.http.post('/event_shares/bulk', payload);
22
+ return response.data;
23
+ }
24
+ async accept(shareId) {
25
+ const response = await this.http.patch(`/event_shares/${shareId}/accept`, {});
26
+ return response.data;
27
+ }
28
+ async decline(shareId) {
29
+ const response = await this.http.patch(`/event_shares/${shareId}/decline`, {});
30
+ return response.data;
31
+ }
32
+ async cancel(shareId) {
33
+ const response = await this.http.delete(`/event_shares/${shareId}`);
34
+ return response.data;
35
+ }
36
+ }
@@ -0,0 +1,14 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Organization, PagedCollection } from '../types.js';
3
+ export declare class OrganizationsClient {
4
+ private http;
5
+ constructor(http: AxiosInstance);
6
+ list(options?: {
7
+ page?: string;
8
+ filters?: {
9
+ [key: string]: string;
10
+ };
11
+ }): Promise<PagedCollection<Organization>>;
12
+ get(id: string): Promise<Organization>;
13
+ }
14
+ //# sourceMappingURL=organizations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organizations.d.ts","sourceRoot":"","sources":["../../src/clients/organizations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG5D,qBAAa,mBAAmB;IAClB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEjC,IAAI,CAAC,OAAO,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACrC,GAAG,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAQpC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAI7C"}
@@ -0,0 +1,17 @@
1
+ import { formatApiParams } from '../http-client.js';
2
+ export class OrganizationsClient {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async list(options) {
7
+ const params = formatApiParams(options?.page, options?.filters);
8
+ const response = await this.http.get('/organizations', {
9
+ params,
10
+ });
11
+ return response.data;
12
+ }
13
+ async get(id) {
14
+ const response = await this.http.get(`/organizations/${id}`);
15
+ return response.data;
16
+ }
17
+ }
@@ -0,0 +1,27 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { PartEvent, CreatePartEventPayload, PagedCollection, PublicEvent } from '../types.js';
3
+ export declare class PartEventsClient {
4
+ private http;
5
+ constructor(http: AxiosInstance);
6
+ list(options?: {
7
+ page?: string;
8
+ filters?: {
9
+ [key: string]: string;
10
+ };
11
+ }): Promise<PagedCollection<PartEvent>>;
12
+ get(id: string): Promise<PartEvent>;
13
+ create(payload: CreatePartEventPayload): Promise<PartEvent>;
14
+ listPublic(options?: {
15
+ page?: string;
16
+ filters?: {
17
+ [key: string]: string;
18
+ };
19
+ }): Promise<PagedCollection<PublicEvent>>;
20
+ listAll(options?: {
21
+ page?: string;
22
+ filters?: {
23
+ [key: string]: string;
24
+ };
25
+ }): Promise<PagedCollection<PartEvent>>;
26
+ }
27
+ //# sourceMappingURL=part-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"part-events.d.ts","sourceRoot":"","sources":["../../src/clients/part-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG9F,qBAAa,gBAAgB;IACf,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEjC,IAAI,CAAC,OAAO,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACrC,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAMjC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAKnC,MAAM,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC;IAK3D,UAAU,CAAC,OAAO,CAAC,EAAE;QACzB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACrC,GAAG,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IAQnC,OAAO,CAAC,OAAO,CAAC,EAAE;QACtB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACrC,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;CAKxC"}
@@ -0,0 +1,31 @@
1
+ import { formatApiParams } from '../http-client.js';
2
+ export class PartEventsClient {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async list(options) {
7
+ const params = formatApiParams(options?.page, options?.filters);
8
+ const response = await this.http.get('/part_events', { params });
9
+ return response.data;
10
+ }
11
+ async get(id) {
12
+ const response = await this.http.get(`/part_events/${id}`);
13
+ return response.data;
14
+ }
15
+ async create(payload) {
16
+ const response = await this.http.post('/part_events', payload);
17
+ return response.data;
18
+ }
19
+ async listPublic(options) {
20
+ const params = formatApiParams(options?.page, options?.filters);
21
+ const response = await this.http.get('/public/events', {
22
+ params,
23
+ });
24
+ return response.data;
25
+ }
26
+ async listAll(options) {
27
+ const params = formatApiParams(options?.page, options?.filters);
28
+ const response = await this.http.get('/events', { params });
29
+ return response.data;
30
+ }
31
+ }
@@ -0,0 +1,15 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { PartModel, CreatePartModelPayload, PagedCollection } from '../types.js';
3
+ export declare class PartModelsClient {
4
+ private http;
5
+ constructor(http: AxiosInstance);
6
+ list(options?: {
7
+ page?: string;
8
+ filters?: {
9
+ [key: string]: string;
10
+ };
11
+ }): Promise<PagedCollection<PartModel>>;
12
+ get(id: string): Promise<PartModel>;
13
+ create(payload: CreatePartModelPayload): Promise<PartModel>;
14
+ }
15
+ //# sourceMappingURL=part-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"part-models.d.ts","sourceRoot":"","sources":["../../src/clients/part-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGjF,qBAAa,gBAAgB;IACf,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEjC,IAAI,CAAC,OAAO,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACrC,GAAG,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAMjC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAKnC,MAAM,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC;CAIlE"}
@@ -0,0 +1,19 @@
1
+ import { formatApiParams } from '../http-client.js';
2
+ export class PartModelsClient {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async list(options) {
7
+ const params = formatApiParams(options?.page, options?.filters);
8
+ const response = await this.http.get('/part_models', { params });
9
+ return response.data;
10
+ }
11
+ async get(id) {
12
+ const response = await this.http.get(`/part_models/${id}`);
13
+ return response.data;
14
+ }
15
+ async create(payload) {
16
+ const response = await this.http.post('/part_models', payload);
17
+ return response.data;
18
+ }
19
+ }
@@ -0,0 +1,20 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Partnership, PagedCollection } from '../types.js';
3
+ export declare class PartnershipsClient {
4
+ private http;
5
+ constructor(http: AxiosInstance);
6
+ list(options?: {
7
+ page?: string;
8
+ filters?: {
9
+ [key: string]: string;
10
+ };
11
+ }): Promise<PagedCollection<Partnership>>;
12
+ get(id: string): Promise<Partnership>;
13
+ listAll(options?: {
14
+ page?: string;
15
+ filters?: {
16
+ [key: string]: string;
17
+ };
18
+ }): Promise<PagedCollection<Partnership>>;
19
+ }
20
+ //# sourceMappingURL=partnerships.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partnerships.d.ts","sourceRoot":"","sources":["../../src/clients/partnerships.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG3D,qBAAa,kBAAkB;IACjB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEjC,IAAI,CAAC,OAAO,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACrC,GAAG,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IAMnC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAKrC,OAAO,CAAC,OAAO,CAAC,EAAE;QACtB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACrC,GAAG,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;CAO1C"}
@@ -0,0 +1,22 @@
1
+ import { formatApiParams } from '../http-client.js';
2
+ export class PartnershipsClient {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async list(options) {
7
+ const params = formatApiParams(options?.page, options?.filters);
8
+ const response = await this.http.get('/partnerships', { params });
9
+ return response.data;
10
+ }
11
+ async get(id) {
12
+ const response = await this.http.get(`/partnerships/${id}`);
13
+ return response.data;
14
+ }
15
+ async listAll(options) {
16
+ const params = formatApiParams(options?.page, options?.filters);
17
+ const response = await this.http.get('/partnerships/all', {
18
+ params,
19
+ });
20
+ return response.data;
21
+ }
22
+ }
@@ -0,0 +1,29 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { Part, CreatePartPayload, PagedCollection } from '../types.js';
3
+ export declare class PartsClient {
4
+ private http;
5
+ constructor(http: AxiosInstance);
6
+ list(options?: {
7
+ page?: string;
8
+ filters?: {
9
+ [key: string]: string;
10
+ };
11
+ }): Promise<PagedCollection<Part>>;
12
+ get(id: string): Promise<Part>;
13
+ create(payload: CreatePartPayload): Promise<Part>;
14
+ createWithEvent(formData: any): Promise<Part>;
15
+ createWithDocuments(formData: any): Promise<Part>;
16
+ processReleaseCertificate(file: any): Promise<{
17
+ success: boolean;
18
+ data: {
19
+ certificateDate: string | null;
20
+ certificateType: string | null;
21
+ trackingNumber: string | null;
22
+ description: string | null;
23
+ partNumber: string | null;
24
+ serialNumber: string | null;
25
+ eventType: string | null;
26
+ };
27
+ }>;
28
+ }
29
+ //# sourceMappingURL=parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../../src/clients/parts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGvE,qBAAa,WAAW;IACV,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEjC,IAAI,CAAC,OAAO,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;KACrC,GAAG,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAM5B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9B,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjD,eAAe,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7C,mBAAmB,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjD,yBAAyB,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC;QAClD,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE;YACJ,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;YAC/B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;YAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;YAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;YAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;YAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;YAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;SAC1B,CAAC;KACH,CAAC;CAYH"}
@@ -0,0 +1,42 @@
1
+ import { formatApiParams } from '../http-client.js';
2
+ export class PartsClient {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async list(options) {
7
+ const params = formatApiParams(options?.page, options?.filters);
8
+ const response = await this.http.get('/parts', { params });
9
+ return response.data;
10
+ }
11
+ async get(id) {
12
+ const response = await this.http.get(`/parts/${id}`);
13
+ return response.data;
14
+ }
15
+ async create(payload) {
16
+ const response = await this.http.post('/parts', payload);
17
+ return response.data;
18
+ }
19
+ async createWithEvent(formData) {
20
+ const response = await this.http.post('/parts/create_with_event', formData, {
21
+ headers: {
22
+ 'Content-Type': 'multipart/form-data',
23
+ },
24
+ });
25
+ return response.data;
26
+ }
27
+ async createWithDocuments(formData) {
28
+ const response = await this.http.post('/parts/create_with_documents', formData);
29
+ return response.data;
30
+ }
31
+ async processReleaseCertificate(file) {
32
+ const formData = new (await import('form-data')).default();
33
+ formData.append('file', file);
34
+ const response = await this.http.post('/release-certificate/process', formData, {
35
+ headers: {
36
+ 'Content-Type': 'multipart/form-data',
37
+ },
38
+ timeout: 60000,
39
+ });
40
+ return response.data;
41
+ }
42
+ }
@@ -0,0 +1,11 @@
1
+ import { AxiosInstance } from 'axios';
2
+ export type RegistrySearchResult = {
3
+ parts: any[];
4
+ aircraft: any[];
5
+ };
6
+ export declare class RegistryClient {
7
+ private http;
8
+ constructor(http: AxiosInstance);
9
+ search(query: string): Promise<RegistrySearchResult>;
10
+ }
11
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/clients/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,QAAQ,EAAE,GAAG,EAAE,CAAC;CACjB,CAAC;AAEF,qBAAa,cAAc;IACb,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEjC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAM3D"}
@@ -0,0 +1,11 @@
1
+ export class RegistryClient {
2
+ constructor(http) {
3
+ this.http = http;
4
+ }
5
+ async search(query) {
6
+ const response = await this.http.get('/registry/search', {
7
+ params: { q: query },
8
+ });
9
+ return response.data;
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { User } from '../types.js';
3
+ export declare class UsersClient {
4
+ private http;
5
+ constructor(http: AxiosInstance);
6
+ get(id: string): Promise<User>;
7
+ }
8
+ //# sourceMappingURL=users.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/clients/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,qBAAa,WAAW;IACV,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAEjC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIrC"}
@@ -0,0 +1,9 @@
1
+ export class UsersClient {
2
+ constructor(http) {
3
+ this.http = http;
4
+ }
5
+ async get(id) {
6
+ const response = await this.http.get(`/users/${id}`);
7
+ return response.data;
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ import { AxiosInstance } from 'axios';
2
+ export declare function createHttpClient(baseURL: string, timeout?: number): AxiosInstance;
3
+ export declare function formatApiParams(page?: string, filters?: {
4
+ [key: string]: string;
5
+ }): {
6
+ [key: string]: any;
7
+ };
8
+ //# sourceMappingURL=http-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../src/http-client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAA6C,MAAM,OAAO,CAAC;AAExF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAc,GAAG,aAAa,CAgExF;AAED,wBAAgB,eAAe,CAC7B,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAClC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAcxB"}
@@ -0,0 +1,63 @@
1
+ import axios from 'axios';
2
+ export function createHttpClient(baseURL, timeout = 30000) {
3
+ const instance = axios.create({
4
+ baseURL,
5
+ timeout,
6
+ headers: {
7
+ Accept: 'application/ld+json',
8
+ 'Content-Type': 'application/ld+json; charset=utf-8',
9
+ },
10
+ });
11
+ instance.interceptors.request.use((config) => {
12
+ if (config.method &&
13
+ config.method.toLowerCase() === 'patch' &&
14
+ !config.headers['Content-Type']) {
15
+ config.headers['Content-Type'] = 'application/merge-patch+json';
16
+ }
17
+ if (typeof config.data !== 'undefined' && !(config.data instanceof FormData)) {
18
+ if (!config.headers['Content-Type']) {
19
+ config.headers['Content-Type'] = 'application/ld+json; charset=utf-8';
20
+ }
21
+ }
22
+ return config;
23
+ });
24
+ instance.interceptors.response.use((response) => response, (error) => {
25
+ if (error.response) {
26
+ const { status, data } = error.response;
27
+ if (status === 400 && data['description']) {
28
+ error.message = data['description'];
29
+ }
30
+ if (status === 403) {
31
+ error.message = 'Access forbidden';
32
+ }
33
+ if (status >= 500) {
34
+ error.message = 'Server error';
35
+ }
36
+ if (status === 422 && data.violations) {
37
+ const formErrors = {};
38
+ data.violations.forEach((violation) => {
39
+ const field = violation.propertyPath;
40
+ if (!formErrors[field]) {
41
+ formErrors[field] = [];
42
+ }
43
+ formErrors[field].push(violation.message);
44
+ });
45
+ error.formErrors = formErrors;
46
+ }
47
+ }
48
+ return Promise.reject(error);
49
+ });
50
+ return instance;
51
+ }
52
+ export function formatApiParams(page, filters) {
53
+ const params = {};
54
+ if (page) {
55
+ params.page = page;
56
+ }
57
+ if (filters) {
58
+ Object.entries(filters).forEach(([key, value]) => {
59
+ params[key] = value;
60
+ });
61
+ }
62
+ return params;
63
+ }
@@ -0,0 +1,7 @@
1
+ export { AerochainClient } from './client.js';
2
+ export type { AerochainClientConfig } from './client.js';
3
+ export type { AuthConfig } from './auth.js';
4
+ export type { EventSharesListOptions } from './clients/event-shares.js';
5
+ export type { RegistrySearchResult } from './clients/registry.js';
6
+ export * from './types.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzD,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE,cAAc,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { AerochainClient } from './client.js';
2
+ export * from './types.js';