@internxt/sdk 1.4.77 → 1.5.25

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 (93) hide show
  1. package/dist/auth/index.d.ts +122 -122
  2. package/dist/auth/index.js +310 -310
  3. package/dist/auth/types.d.ts +54 -54
  4. package/dist/auth/types.js +26 -26
  5. package/dist/drive/backups/index.d.ts +18 -18
  6. package/dist/drive/backups/index.js +40 -40
  7. package/dist/drive/backups/types.d.ts +27 -27
  8. package/dist/drive/backups/types.js +2 -2
  9. package/dist/drive/index.d.ts +7 -7
  10. package/dist/drive/index.js +19 -19
  11. package/dist/drive/payments/index.d.ts +71 -53
  12. package/dist/drive/payments/index.js +208 -153
  13. package/dist/drive/payments/types.d.ts +176 -114
  14. package/dist/drive/payments/types.js +37 -32
  15. package/dist/drive/referrals/index.d.ts +19 -19
  16. package/dist/drive/referrals/index.js +50 -50
  17. package/dist/drive/referrals/types.d.ts +21 -21
  18. package/dist/drive/referrals/types.js +18 -18
  19. package/dist/drive/share/index.d.ts +319 -319
  20. package/dist/drive/share/index.js +540 -539
  21. package/dist/drive/share/types.d.ts +360 -358
  22. package/dist/drive/share/types.js +2 -2
  23. package/dist/drive/storage/index.d.ts +315 -195
  24. package/dist/drive/storage/index.js +630 -434
  25. package/dist/drive/storage/types.d.ts +473 -394
  26. package/dist/drive/storage/types.js +13 -13
  27. package/dist/drive/trash/index.d.ts +75 -55
  28. package/dist/drive/trash/index.js +180 -149
  29. package/dist/drive/trash/types.d.ts +29 -20
  30. package/dist/drive/trash/types.js +2 -2
  31. package/dist/drive/users/index.d.ts +135 -108
  32. package/dist/drive/users/index.js +204 -174
  33. package/dist/drive/users/types.d.ts +51 -43
  34. package/dist/drive/users/types.js +2 -2
  35. package/dist/index.d.ts +6 -5
  36. package/dist/index.js +31 -30
  37. package/dist/network/download.d.ts +8 -8
  38. package/dist/network/download.js +123 -123
  39. package/dist/network/errors/codes.d.ts +24 -24
  40. package/dist/network/errors/codes.js +48 -48
  41. package/dist/network/errors/context.d.ts +35 -35
  42. package/dist/network/errors/context.js +39 -39
  43. package/dist/network/errors/download.d.ts +4 -4
  44. package/dist/network/errors/download.js +48 -48
  45. package/dist/network/errors/index.d.ts +3 -3
  46. package/dist/network/errors/index.js +15 -15
  47. package/dist/network/errors/upload.d.ts +13 -13
  48. package/dist/network/errors/upload.js +78 -78
  49. package/dist/network/index.d.ts +70 -71
  50. package/dist/network/index.js +311 -310
  51. package/dist/network/types.d.ts +102 -102
  52. package/dist/network/types.js +18 -18
  53. package/dist/network/upload.d.ts +4 -4
  54. package/dist/network/upload.js +159 -159
  55. package/dist/photos/devices/index.d.ts +10 -10
  56. package/dist/photos/devices/index.js +79 -79
  57. package/dist/photos/index.d.ts +17 -17
  58. package/dist/photos/index.js +52 -52
  59. package/dist/photos/photos/index.d.ts +60 -60
  60. package/dist/photos/photos/index.js +225 -225
  61. package/dist/photos/shares/index.d.ts +8 -8
  62. package/dist/photos/shares/index.js +34 -34
  63. package/dist/photos/types.d.ts +154 -154
  64. package/dist/photos/types.js +19 -19
  65. package/dist/photos/users/index.d.ts +7 -7
  66. package/dist/photos/users/index.js +46 -46
  67. package/dist/shared/headers/index.d.ts +21 -18
  68. package/dist/shared/headers/index.js +79 -69
  69. package/dist/shared/http/client.d.ts +85 -85
  70. package/dist/shared/http/client.js +172 -181
  71. package/dist/shared/http/types.d.ts +7 -7
  72. package/dist/shared/http/types.js +2 -2
  73. package/dist/shared/index.d.ts +1 -1
  74. package/dist/shared/index.js +13 -13
  75. package/dist/shared/types/apiConnection.d.ts +12 -11
  76. package/dist/shared/types/apiConnection.js +2 -2
  77. package/dist/shared/types/appsumo.d.ts +16 -16
  78. package/dist/shared/types/appsumo.js +12 -12
  79. package/dist/shared/types/errors.d.ts +5 -4
  80. package/dist/shared/types/errors.js +28 -27
  81. package/dist/shared/types/teams.d.ts +9 -9
  82. package/dist/shared/types/teams.js +2 -2
  83. package/dist/shared/types/userSettings.d.ts +29 -27
  84. package/dist/shared/types/userSettings.js +2 -2
  85. package/dist/utils.d.ts +3 -3
  86. package/dist/utils.js +25 -25
  87. package/dist/workspaces/index.d.ts +176 -0
  88. package/dist/workspaces/index.js +415 -0
  89. package/dist/workspaces/index.test.d.ts +1 -0
  90. package/dist/workspaces/index.test.js +903 -0
  91. package/dist/workspaces/types.d.ts +291 -0
  92. package/dist/workspaces/types.js +2 -0
  93. package/package.json +1 -1
@@ -1,154 +1,154 @@
1
- export interface PhotosSdkModel {
2
- baseUrl: string;
3
- accessToken?: string;
4
- }
5
- export declare type UserId = string;
6
- export interface User {
7
- id: UserId;
8
- uuid: string;
9
- bucketId: string;
10
- createdAt: Date;
11
- updatedAt: Date;
12
- }
13
- export interface UserJSON extends Omit<User, 'createdAt' | 'updatedAt'> {
14
- createdAt: string;
15
- updatedAt: string;
16
- }
17
- export interface InitializeUserData {
18
- mac: string;
19
- name: string;
20
- bridgeUser: string;
21
- bridgePassword: string;
22
- }
23
- export declare type DeviceId = string;
24
- export interface Device {
25
- id: DeviceId;
26
- mac: string;
27
- name: string;
28
- userId: string;
29
- newestDate: Date;
30
- oldestDate: Date | null;
31
- createdAt: Date;
32
- updatedAt: Date;
33
- }
34
- export interface DeviceJSON extends Omit<Device, 'newestDate' | 'oldestDate' | 'createdAt' | 'updatedAt'> {
35
- newestDate: string;
36
- oldestDate: string | null;
37
- createdAt: string;
38
- updatedAt: string;
39
- }
40
- export interface CreateDeviceData {
41
- mac: string;
42
- name: string;
43
- userId: string;
44
- }
45
- export declare enum PhotoStatus {
46
- Exists = "EXISTS",
47
- Trashed = "TRASHED",
48
- Deleted = "DELETED"
49
- }
50
- export declare enum PhotosSortBy {
51
- UpdatedAt = "updatedAt",
52
- TakenAt = "takenAt"
53
- }
54
- export declare type FileId = string;
55
- export declare type PhotoId = string;
56
- export declare type PhotoPreviewType = 'PNG' | 'JPEG';
57
- export declare enum PhotosItemType {
58
- PHOTO = "PHOTO",
59
- VIDEO = "VIDEO"
60
- }
61
- export interface Photo {
62
- id: PhotoId;
63
- name: string;
64
- type: string;
65
- size: number;
66
- width: number;
67
- height: number;
68
- fileId: FileId;
69
- previewId: FileId;
70
- previews?: {
71
- width: number;
72
- height: number;
73
- size: number;
74
- fileId: FileId;
75
- type: PhotoPreviewType;
76
- }[];
77
- deviceId: DeviceId;
78
- userId: string;
79
- status: PhotoStatus;
80
- statusChangedAt: Date;
81
- hash: string;
82
- takenAt: Date;
83
- createdAt: Date;
84
- updatedAt: Date;
85
- duration?: number;
86
- itemType: PhotosItemType;
87
- networkBucketId?: string;
88
- }
89
- export interface UpdatePhotoPayload {
90
- previews?: {
91
- width: number;
92
- height: number;
93
- size: number;
94
- fileId: FileId;
95
- type: PhotoPreviewType;
96
- }[];
97
- }
98
- export interface PhotoWithDownloadLink extends Photo {
99
- previewLink: string;
100
- previewIndex: string;
101
- }
102
- export interface PhotoJSON extends Omit<Photo, 'statusChangedAt' | 'takenAt' | 'createdAt' | 'updatedAt'> {
103
- statusChangedAt: string;
104
- takenAt: string;
105
- createdAt: string;
106
- updatedAt: string;
107
- }
108
- export declare type CreatePhotoData = Omit<Photo, 'id' | 'status' | 'statusChangedAt' | 'createdAt' | 'updatedAt'> & {
109
- networkBucketId: string;
110
- };
111
- export declare type ShareId = string;
112
- export interface Share {
113
- id: ShareId;
114
- bucket: string;
115
- photoIds: PhotoId[];
116
- token: string;
117
- views: number;
118
- createdAt: Date;
119
- updatedAt: Date;
120
- }
121
- export interface ShareJSON extends Omit<Share, 'createdAt' | 'updatedAt'> {
122
- createdAt: string;
123
- updatedAt: string;
124
- }
125
- export declare type CreatePhotoShareBody = Pick<Share, 'views' | 'photoIds' | 'bucket' | 'token'> & {
126
- encryptedMnemonic: string;
127
- };
128
- export declare type GetPhotoShareResponse = Share & {
129
- photos: (Pick<Photo, 'fileId' | 'name' | 'size' | 'type'> & {
130
- decryptionKey: string;
131
- })[];
132
- };
133
- export declare type PhotoExistsPayload = {
134
- hash: string;
135
- name: string;
136
- takenAt: string;
137
- };
138
- export declare type PhotoExistsDataJSON = (PhotoExistsPayload | PhotoJSON) & {
139
- exists: boolean;
140
- };
141
- export declare type PhotoExistsData = ((Omit<PhotoExistsPayload, 'takenAt'> & {
142
- takenAt: Date;
143
- }) | Photo) & {
144
- exists: boolean;
145
- };
146
- export declare type PhotosUsage = {
147
- usage: number;
148
- };
149
- export declare type PhotosCount = {
150
- existent: number;
151
- trashed: number;
152
- deleted: number;
153
- total: number;
154
- };
1
+ export interface PhotosSdkModel {
2
+ baseUrl: string;
3
+ accessToken?: string;
4
+ }
5
+ export declare type UserId = string;
6
+ export interface User {
7
+ id: UserId;
8
+ uuid: string;
9
+ bucketId: string;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ }
13
+ export interface UserJSON extends Omit<User, 'createdAt' | 'updatedAt'> {
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ }
17
+ export interface InitializeUserData {
18
+ mac: string;
19
+ name: string;
20
+ bridgeUser: string;
21
+ bridgePassword: string;
22
+ }
23
+ export declare type DeviceId = string;
24
+ export interface Device {
25
+ id: DeviceId;
26
+ mac: string;
27
+ name: string;
28
+ userId: string;
29
+ newestDate: Date;
30
+ oldestDate: Date | null;
31
+ createdAt: Date;
32
+ updatedAt: Date;
33
+ }
34
+ export interface DeviceJSON extends Omit<Device, 'newestDate' | 'oldestDate' | 'createdAt' | 'updatedAt'> {
35
+ newestDate: string;
36
+ oldestDate: string | null;
37
+ createdAt: string;
38
+ updatedAt: string;
39
+ }
40
+ export interface CreateDeviceData {
41
+ mac: string;
42
+ name: string;
43
+ userId: string;
44
+ }
45
+ export declare enum PhotoStatus {
46
+ Exists = "EXISTS",
47
+ Trashed = "TRASHED",
48
+ Deleted = "DELETED"
49
+ }
50
+ export declare enum PhotosSortBy {
51
+ UpdatedAt = "updatedAt",
52
+ TakenAt = "takenAt"
53
+ }
54
+ export declare type FileId = string;
55
+ export declare type PhotoId = string;
56
+ export declare type PhotoPreviewType = 'PNG' | 'JPEG';
57
+ export declare enum PhotosItemType {
58
+ PHOTO = "PHOTO",
59
+ VIDEO = "VIDEO"
60
+ }
61
+ export interface Photo {
62
+ id: PhotoId;
63
+ name: string;
64
+ type: string;
65
+ size: number;
66
+ width: number;
67
+ height: number;
68
+ fileId: FileId;
69
+ previewId: FileId;
70
+ previews?: {
71
+ width: number;
72
+ height: number;
73
+ size: number;
74
+ fileId: FileId;
75
+ type: PhotoPreviewType;
76
+ }[];
77
+ deviceId: DeviceId;
78
+ userId: string;
79
+ status: PhotoStatus;
80
+ statusChangedAt: Date;
81
+ hash: string;
82
+ takenAt: Date;
83
+ createdAt: Date;
84
+ updatedAt: Date;
85
+ duration?: number;
86
+ itemType: PhotosItemType;
87
+ networkBucketId?: string;
88
+ }
89
+ export interface UpdatePhotoPayload {
90
+ previews?: {
91
+ width: number;
92
+ height: number;
93
+ size: number;
94
+ fileId: FileId;
95
+ type: PhotoPreviewType;
96
+ }[];
97
+ }
98
+ export interface PhotoWithDownloadLink extends Photo {
99
+ previewLink: string;
100
+ previewIndex: string;
101
+ }
102
+ export interface PhotoJSON extends Omit<Photo, 'statusChangedAt' | 'takenAt' | 'createdAt' | 'updatedAt'> {
103
+ statusChangedAt: string;
104
+ takenAt: string;
105
+ createdAt: string;
106
+ updatedAt: string;
107
+ }
108
+ export declare type CreatePhotoData = Omit<Photo, 'id' | 'status' | 'statusChangedAt' | 'createdAt' | 'updatedAt'> & {
109
+ networkBucketId: string;
110
+ };
111
+ export declare type ShareId = string;
112
+ export interface Share {
113
+ id: ShareId;
114
+ bucket: string;
115
+ photoIds: PhotoId[];
116
+ token: string;
117
+ views: number;
118
+ createdAt: Date;
119
+ updatedAt: Date;
120
+ }
121
+ export interface ShareJSON extends Omit<Share, 'createdAt' | 'updatedAt'> {
122
+ createdAt: string;
123
+ updatedAt: string;
124
+ }
125
+ export declare type CreatePhotoShareBody = Pick<Share, 'views' | 'photoIds' | 'bucket' | 'token'> & {
126
+ encryptedMnemonic: string;
127
+ };
128
+ export declare type GetPhotoShareResponse = Share & {
129
+ photos: (Pick<Photo, 'fileId' | 'name' | 'size' | 'type'> & {
130
+ decryptionKey: string;
131
+ })[];
132
+ };
133
+ export declare type PhotoExistsPayload = {
134
+ hash: string;
135
+ name: string;
136
+ takenAt: string;
137
+ };
138
+ export declare type PhotoExistsDataJSON = (PhotoExistsPayload | PhotoJSON) & {
139
+ exists: boolean;
140
+ };
141
+ export declare type PhotoExistsData = ((Omit<PhotoExistsPayload, 'takenAt'> & {
142
+ takenAt: Date;
143
+ }) | Photo) & {
144
+ exists: boolean;
145
+ };
146
+ export declare type PhotosUsage = {
147
+ usage: number;
148
+ };
149
+ export declare type PhotosCount = {
150
+ existent: number;
151
+ trashed: number;
152
+ deleted: number;
153
+ total: number;
154
+ };
@@ -1,19 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PhotosItemType = exports.PhotosSortBy = exports.PhotoStatus = void 0;
4
- var PhotoStatus;
5
- (function (PhotoStatus) {
6
- PhotoStatus["Exists"] = "EXISTS";
7
- PhotoStatus["Trashed"] = "TRASHED";
8
- PhotoStatus["Deleted"] = "DELETED";
9
- })(PhotoStatus = exports.PhotoStatus || (exports.PhotoStatus = {}));
10
- var PhotosSortBy;
11
- (function (PhotosSortBy) {
12
- PhotosSortBy["UpdatedAt"] = "updatedAt";
13
- PhotosSortBy["TakenAt"] = "takenAt";
14
- })(PhotosSortBy = exports.PhotosSortBy || (exports.PhotosSortBy = {}));
15
- var PhotosItemType;
16
- (function (PhotosItemType) {
17
- PhotosItemType["PHOTO"] = "PHOTO";
18
- PhotosItemType["VIDEO"] = "VIDEO";
19
- })(PhotosItemType = exports.PhotosItemType || (exports.PhotosItemType = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PhotosItemType = exports.PhotosSortBy = exports.PhotoStatus = void 0;
4
+ var PhotoStatus;
5
+ (function (PhotoStatus) {
6
+ PhotoStatus["Exists"] = "EXISTS";
7
+ PhotoStatus["Trashed"] = "TRASHED";
8
+ PhotoStatus["Deleted"] = "DELETED";
9
+ })(PhotoStatus = exports.PhotoStatus || (exports.PhotoStatus = {}));
10
+ var PhotosSortBy;
11
+ (function (PhotosSortBy) {
12
+ PhotosSortBy["UpdatedAt"] = "updatedAt";
13
+ PhotosSortBy["TakenAt"] = "takenAt";
14
+ })(PhotosSortBy = exports.PhotosSortBy || (exports.PhotosSortBy = {}));
15
+ var PhotosItemType;
16
+ (function (PhotosItemType) {
17
+ PhotosItemType["PHOTO"] = "PHOTO";
18
+ PhotosItemType["VIDEO"] = "VIDEO";
19
+ })(PhotosItemType = exports.PhotosItemType || (exports.PhotosItemType = {}));
@@ -1,7 +1,7 @@
1
- import { InitializeUserData, PhotosSdkModel, User } from '..';
2
- export default class UsersSubmodule {
3
- private model;
4
- constructor(model: PhotosSdkModel);
5
- initialize(data: InitializeUserData): Promise<User>;
6
- private parse;
7
- }
1
+ import { InitializeUserData, PhotosSdkModel, User } from '..';
2
+ export default class UsersSubmodule {
3
+ private model;
4
+ constructor(model: PhotosSdkModel);
5
+ initialize(data: InitializeUserData): Promise<User>;
6
+ private parse;
7
+ }
@@ -1,46 +1,46 @@
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
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- var axios_1 = __importDefault(require("axios"));
18
- var utils_1 = require("../../utils");
19
- var UsersSubmodule = /** @class */ (function () {
20
- function UsersSubmodule(model) {
21
- this.model = model;
22
- }
23
- UsersSubmodule.prototype.initialize = function (data) {
24
- var _this = this;
25
- return axios_1.default
26
- .post(this.model.baseUrl + "/users", {
27
- mac: data.mac,
28
- name: data.name,
29
- }, {
30
- headers: {
31
- Authorization: "Bearer " + this.model.accessToken,
32
- 'internxt-network-pass': data.bridgePassword,
33
- 'internxt-network-user': data.bridgeUser,
34
- },
35
- })
36
- .then(function (res) { return _this.parse(res.data); })
37
- .catch(function (err) {
38
- throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
39
- });
40
- };
41
- UsersSubmodule.prototype.parse = function (json) {
42
- return __assign(__assign({}, json), { createdAt: new Date(json.createdAt), updatedAt: new Date(json.updatedAt) });
43
- };
44
- return UsersSubmodule;
45
- }());
46
- exports.default = UsersSubmodule;
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
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var axios_1 = __importDefault(require("axios"));
18
+ var utils_1 = require("../../utils");
19
+ var UsersSubmodule = /** @class */ (function () {
20
+ function UsersSubmodule(model) {
21
+ this.model = model;
22
+ }
23
+ UsersSubmodule.prototype.initialize = function (data) {
24
+ var _this = this;
25
+ return axios_1.default
26
+ .post(this.model.baseUrl + "/users", {
27
+ mac: data.mac,
28
+ name: data.name,
29
+ }, {
30
+ headers: {
31
+ Authorization: "Bearer " + this.model.accessToken,
32
+ 'internxt-network-pass': data.bridgePassword,
33
+ 'internxt-network-user': data.bridgeUser,
34
+ },
35
+ })
36
+ .then(function (res) { return _this.parse(res.data); })
37
+ .catch(function (err) {
38
+ throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
39
+ });
40
+ };
41
+ UsersSubmodule.prototype.parse = function (json) {
42
+ return __assign(__assign({}, json), { createdAt: new Date(json.createdAt), updatedAt: new Date(json.updatedAt) });
43
+ };
44
+ return UsersSubmodule;
45
+ }());
46
+ exports.default = UsersSubmodule;
@@ -1,18 +1,21 @@
1
- import { BasicAuth, Token } from '../../auth';
2
- declare type InternxtHeaders = {
3
- 'content-type': string;
4
- 'internxt-version': string;
5
- 'internxt-client': string;
6
- 'x-share-password'?: string;
7
- 'Authorization'?: string;
8
- 'x-token'?: string;
9
- 'internxt-resources-token'?: string;
10
- };
11
- export declare function basicHeaders(clientName: string, clientVersion: string): InternxtHeaders;
12
- export declare function basicHeadersWithPassword(clientName: string, clientVersion: string, password: string): InternxtHeaders;
13
- export declare function headersWithToken(clientName: string, clientVersion: string, token: Token): InternxtHeaders;
14
- export declare function headersWithTokenAndPassword(clientName: string, clientVersion: string, token: Token, password: string): InternxtHeaders;
15
- export declare function headersWithBasicAuth(clientName: string, clientVersion: string, auth: BasicAuth): InternxtHeaders;
16
- export declare function headersWithAuthToken(clientName: string, clientVersion: string, token: Token): InternxtHeaders;
17
- export declare function addResourcesTokenToHeaders(headers: InternxtHeaders, resourcesToken?: Token): InternxtHeaders;
18
- export {};
1
+ import { BasicAuth, Token } from '../../auth';
2
+ export interface CustomHeaders {
3
+ [key: string]: string;
4
+ }
5
+ declare type InternxtHeaders = {
6
+ 'content-type': string;
7
+ 'internxt-version': string;
8
+ 'internxt-client': string;
9
+ 'x-share-password'?: string;
10
+ Authorization?: string;
11
+ 'x-token'?: string;
12
+ 'internxt-resources-token'?: string;
13
+ };
14
+ export declare function basicHeaders(clientName: string, clientVersion: string): InternxtHeaders;
15
+ export declare function basicHeadersWithPassword(clientName: string, clientVersion: string, password: string): InternxtHeaders;
16
+ export declare function headersWithToken(clientName: string, clientVersion: string, token: Token, workspaceToken?: Token, customHeaders?: CustomHeaders): InternxtHeaders;
17
+ export declare function headersWithTokenAndPassword(clientName: string, clientVersion: string, token: Token, workspaceToken: Token | undefined, password: string): InternxtHeaders;
18
+ export declare function headersWithBasicAuth(clientName: string, clientVersion: string, auth: BasicAuth, workspaceToken?: Token): InternxtHeaders;
19
+ export declare function headersWithAuthToken(clientName: string, clientVersion: string, token: Token, workspaceToken?: Token): InternxtHeaders;
20
+ export declare function addResourcesTokenToHeaders(headers: InternxtHeaders, resourcesToken?: Token): InternxtHeaders;
21
+ export {};
@@ -1,69 +1,79 @@
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
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.addResourcesTokenToHeaders = exports.headersWithAuthToken = exports.headersWithBasicAuth = exports.headersWithTokenAndPassword = exports.headersWithToken = exports.basicHeadersWithPassword = exports.basicHeaders = void 0;
15
- function basicHeaders(clientName, clientVersion) {
16
- return {
17
- 'content-type': 'application/json; charset=utf-8',
18
- 'internxt-version': clientVersion,
19
- 'internxt-client': clientName,
20
- };
21
- }
22
- exports.basicHeaders = basicHeaders;
23
- function basicHeadersWithPassword(clientName, clientVersion, password) {
24
- return {
25
- 'content-type': 'application/json; charset=utf-8',
26
- 'internxt-version': clientVersion,
27
- 'internxt-client': clientName,
28
- 'x-share-password': password,
29
- };
30
- }
31
- exports.basicHeadersWithPassword = basicHeadersWithPassword;
32
- function headersWithToken(clientName, clientVersion, token) {
33
- var headers = basicHeaders(clientName, clientVersion);
34
- var extra = {
35
- 'Authorization': 'Bearer ' + token,
36
- };
37
- return __assign(__assign({}, headers), extra);
38
- }
39
- exports.headersWithToken = headersWithToken;
40
- function headersWithTokenAndPassword(clientName, clientVersion, token, password) {
41
- var headers = headersWithToken(clientName, clientVersion, token);
42
- var extra = {
43
- 'x-share-password': password,
44
- };
45
- return __assign(__assign({}, headers), extra);
46
- }
47
- exports.headersWithTokenAndPassword = headersWithTokenAndPassword;
48
- function headersWithBasicAuth(clientName, clientVersion, auth) {
49
- var headers = basicHeaders(clientName, clientVersion);
50
- var token = auth.username + ":" + auth.password;
51
- var encodedToken = Buffer.from(token).toString('base64');
52
- var extra = {
53
- 'Authorization': 'Basic ' + encodedToken,
54
- };
55
- return __assign(__assign({}, headers), extra);
56
- }
57
- exports.headersWithBasicAuth = headersWithBasicAuth;
58
- function headersWithAuthToken(clientName, clientVersion, token) {
59
- var headers = basicHeaders(clientName, clientVersion);
60
- return __assign(__assign({}, headers), { 'x-token': token });
61
- }
62
- exports.headersWithAuthToken = headersWithAuthToken;
63
- function addResourcesTokenToHeaders(headers, resourcesToken) {
64
- if (resourcesToken && resourcesToken.length > 0) {
65
- return __assign(__assign({}, headers), { 'internxt-resources-token': resourcesToken });
66
- }
67
- return headers;
68
- }
69
- exports.addResourcesTokenToHeaders = addResourcesTokenToHeaders;
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
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.addResourcesTokenToHeaders = exports.headersWithAuthToken = exports.headersWithBasicAuth = exports.headersWithTokenAndPassword = exports.headersWithToken = exports.basicHeadersWithPassword = exports.basicHeaders = void 0;
15
+ function basicHeaders(clientName, clientVersion) {
16
+ return {
17
+ 'content-type': 'application/json; charset=utf-8',
18
+ 'internxt-version': clientVersion,
19
+ 'internxt-client': clientName,
20
+ };
21
+ }
22
+ exports.basicHeaders = basicHeaders;
23
+ function basicHeadersWithPassword(clientName, clientVersion, password) {
24
+ return {
25
+ 'content-type': 'application/json; charset=utf-8',
26
+ 'internxt-version': clientVersion,
27
+ 'internxt-client': clientName,
28
+ 'x-share-password': password,
29
+ };
30
+ }
31
+ exports.basicHeadersWithPassword = basicHeadersWithPassword;
32
+ function headersWithToken(clientName, clientVersion, token, workspaceToken, customHeaders) {
33
+ var headers = basicHeaders(clientName, clientVersion);
34
+ var extra = {
35
+ Authorization: 'Bearer ' + token,
36
+ };
37
+ if (workspaceToken !== undefined) {
38
+ extra['x-internxt-workspace'] = workspaceToken;
39
+ }
40
+ return __assign(__assign(__assign({}, headers), extra), customHeaders);
41
+ }
42
+ exports.headersWithToken = headersWithToken;
43
+ function headersWithTokenAndPassword(clientName, clientVersion, token, workspaceToken, password) {
44
+ var headers = headersWithToken(clientName, clientVersion, token, workspaceToken);
45
+ var extra = {
46
+ 'x-share-password': password,
47
+ };
48
+ return __assign(__assign({}, headers), extra);
49
+ }
50
+ exports.headersWithTokenAndPassword = headersWithTokenAndPassword;
51
+ function headersWithBasicAuth(clientName, clientVersion, auth, workspaceToken) {
52
+ var headers = basicHeaders(clientName, clientVersion);
53
+ var token = auth.username + ":" + auth.password;
54
+ var encodedToken = Buffer.from(token).toString('base64');
55
+ var extra = {
56
+ Authorization: 'Basic ' + encodedToken,
57
+ };
58
+ if (workspaceToken !== undefined) {
59
+ extra['x-internxt-workspace'] = workspaceToken;
60
+ }
61
+ return __assign(__assign({}, headers), extra);
62
+ }
63
+ exports.headersWithBasicAuth = headersWithBasicAuth;
64
+ function headersWithAuthToken(clientName, clientVersion, token, workspaceToken) {
65
+ var headers = basicHeaders(clientName, clientVersion);
66
+ var extra = {};
67
+ if (workspaceToken !== undefined) {
68
+ extra['x-internxt-workspace'] = workspaceToken;
69
+ }
70
+ return __assign(__assign(__assign({}, headers), { 'x-token': token }), extra);
71
+ }
72
+ exports.headersWithAuthToken = headersWithAuthToken;
73
+ function addResourcesTokenToHeaders(headers, resourcesToken) {
74
+ if (resourcesToken && resourcesToken.length > 0) {
75
+ return __assign(__assign({}, headers), { 'internxt-resources-token': resourcesToken });
76
+ }
77
+ return headers;
78
+ }
79
+ exports.addResourcesTokenToHeaders = addResourcesTokenToHeaders;