@appconda/nextjs 1.0.18 → 1.0.19
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/dist/Cache/Adapter.js +1 -0
- package/dist/Cache/Adapters/Filesystem.js +102 -0
- package/dist/Cache/Adapters/Memory.js +46 -0
- package/dist/Cache/Adapters/None.js +27 -0
- package/dist/Cache/Adapters/Redis.js +79 -0
- package/dist/Cache/Adapters/Sharding.js +72 -0
- package/dist/Cache/Cache.js +51 -0
- package/dist/Cache/index.js +5 -0
- package/dist/Cache/test.js +0 -0
- package/dist/Services.js +28 -0
- package/dist/actions/actionClient.js +35 -0
- package/dist/actions/index.js +1 -0
- package/dist/actions/nodes.js +9 -0
- package/dist/client.js +334 -0
- package/dist/decorators/Cache.js +78 -0
- package/dist/decorators/CacheKey.js +8 -0
- package/dist/decorators/Invalidate.js +46 -0
- package/dist/enums/api-service.js +14 -0
- package/dist/enums/api.js +6 -0
- package/dist/enums/auth-method.js +10 -0
- package/dist/enums/authentication-factor.js +7 -0
- package/dist/enums/authenticator-type.js +4 -0
- package/dist/enums/browser.js +17 -0
- package/dist/enums/compression.js +6 -0
- package/dist/enums/credit-card.js +19 -0
- package/dist/enums/database-usage-range.js +6 -0
- package/dist/enums/email-template-locale.js +134 -0
- package/dist/enums/email-template-type.js +10 -0
- package/dist/enums/entities/EntityLimitType.js +5 -0
- package/dist/enums/entities/PropertyAttributeName.js +28 -0
- package/dist/enums/entities/PropertyCondition.js +9 -0
- package/dist/enums/entities/PropertyType.js +17 -0
- package/dist/enums/entities/PropertyValueType.js +7 -0
- package/dist/enums/entities/RowAccess.js +1 -0
- package/dist/enums/entities/ViewFilterCondition.js +13 -0
- package/dist/enums/execution-method.js +9 -0
- package/dist/enums/flag.js +198 -0
- package/dist/enums/function-usage-range.js +6 -0
- package/dist/enums/image-format.js +8 -0
- package/dist/enums/image-gravity.js +12 -0
- package/dist/enums/index-type.js +6 -0
- package/dist/enums/messaging-provider-type.js +6 -0
- package/dist/enums/name.js +15 -0
- package/dist/enums/o-auth-provider copy.js +42 -0
- package/dist/enums/o-auth-provider.js +42 -0
- package/dist/enums/password-hash.js +14 -0
- package/dist/enums/platform-type.js +18 -0
- package/dist/enums/project-usage-range.js +5 -0
- package/dist/enums/region.js +5 -0
- package/dist/enums/relation-mutate.js +6 -0
- package/dist/enums/relationship-type.js +7 -0
- package/dist/enums/resource-type.js +5 -0
- package/dist/enums/runtime.js +49 -0
- package/dist/enums/s-m-t-p-secure.js +4 -0
- package/dist/enums/shared/ApplicationLayout.js +5 -0
- package/dist/enums/shared/Colors.js +25 -0
- package/dist/enums/shared/InputType.js +7 -0
- package/dist/enums/shared/Periodicity.js +8 -0
- package/dist/enums/shared/SvgIcon.js +38 -0
- package/dist/enums/shared/Theme.js +5 -0
- package/dist/enums/sms-template-locale.js +134 -0
- package/dist/enums/sms-template-type.js +7 -0
- package/dist/enums/smtp-encryption.js +6 -0
- package/dist/enums/storage-usage-range.js +6 -0
- package/dist/enums/subscriptions/PricingModel.js +11 -0
- package/dist/enums/subscriptions/SubscriptionBillingPeriod.js +10 -0
- package/dist/enums/subscriptions/SubscriptionFeatureLimitType.js +12 -0
- package/dist/enums/subscriptions/SubscriptionPriceType.js +7 -0
- package/dist/enums/tenants/LinkedAccountStatus.js +6 -0
- package/dist/enums/tenants/TenantUserJoined.js +7 -0
- package/dist/enums/tenants/TenantUserStatus.js +7 -0
- package/dist/enums/tenants/TenantUserType.js +6 -0
- package/dist/enums/user-usage-range.js +6 -0
- package/dist/getAppcondaClient.js +42 -0
- package/dist/getSDKForCurrentUser.js +62 -0
- package/dist/id.js +44 -0
- package/dist/iife/sdk.js +7063 -7805
- package/dist/index.js +12558 -0
- package/dist/index.js.map +1 -0
- package/dist/inputFile.js +16 -0
- package/dist/lib/Registry/Registry.js +55 -0
- package/dist/lib/Registry/index.js +1 -0
- package/dist/models.js +1 -0
- package/dist/permission.js +53 -0
- package/dist/query.js +203 -0
- package/dist/role.js +93 -0
- package/dist/service-client.js +13 -0
- package/dist/service.js +22 -0
- package/dist/services/account.js +1259 -0
- package/dist/services/applets.js +39 -0
- package/dist/services/avatars.js +250 -0
- package/dist/services/community.js +68 -0
- package/dist/services/configuration.js +10 -0
- package/dist/services/databases.js +1735 -0
- package/dist/services/functions.js +809 -0
- package/dist/services/graphql.js +56 -0
- package/dist/services/health.js +462 -0
- package/dist/services/locale.js +143 -0
- package/dist/services/messaging.js +1919 -0
- package/dist/services/node.js +10 -0
- package/dist/services/permissions.js +89 -0
- package/dist/services/pricing.js +20 -0
- package/dist/services/projects.js +1525 -0
- package/dist/services/roles.js +71 -0
- package/dist/services/schema.js +47 -0
- package/dist/services/storage.js +473 -0
- package/dist/services/subscription.js +45 -0
- package/dist/services/teams.js +394 -0
- package/dist/services/tenant-subscription.js +51 -0
- package/dist/services/tenant.js +124 -0
- package/dist/services/users.js +1282 -0
- package/dist/services/waitlist.js +11 -0
- package/package.json +5 -12
- package/tsconfig.json +2 -1
- package/dist/cjs/sdk.js +0 -13300
- package/dist/cjs/sdk.js.map +0 -1
- package/dist/esm/sdk.js +0 -13278
- package/dist/esm/sdk.js.map +0 -1
@@ -0,0 +1,16 @@
|
|
1
|
+
import { File } from "node-fetch-native-with-agent";
|
2
|
+
import { realpathSync, readFileSync } from "fs";
|
3
|
+
export class InputFile {
|
4
|
+
static fromBuffer(parts, name) {
|
5
|
+
return new File([parts], name);
|
6
|
+
}
|
7
|
+
static fromPath(path, name) {
|
8
|
+
const realPath = realpathSync(path);
|
9
|
+
const contents = readFileSync(realPath);
|
10
|
+
return this.fromBuffer(contents, name);
|
11
|
+
}
|
12
|
+
static fromPlainText(content, name) {
|
13
|
+
const arrayBytes = new TextEncoder().encode(content);
|
14
|
+
return this.fromBuffer(arrayBytes, name);
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
export class Registry {
|
2
|
+
constructor() {
|
3
|
+
/**
|
4
|
+
* List of all callbacks
|
5
|
+
*/
|
6
|
+
this.callbacks = {};
|
7
|
+
/**
|
8
|
+
* List of all fresh resources
|
9
|
+
*/
|
10
|
+
this.fresh = {};
|
11
|
+
/**
|
12
|
+
* List of all connections
|
13
|
+
*/
|
14
|
+
this.registry = {
|
15
|
+
'default': {},
|
16
|
+
};
|
17
|
+
/**
|
18
|
+
* Current context
|
19
|
+
*/
|
20
|
+
this._context = 'default';
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Set a new connection callback
|
24
|
+
*/
|
25
|
+
set(name, callback, fresh = false) {
|
26
|
+
if (this.registry[this._context].hasOwnProperty(name)) {
|
27
|
+
delete this.registry[this._context][name];
|
28
|
+
}
|
29
|
+
this.fresh[name] = fresh;
|
30
|
+
this.callbacks[name] = callback;
|
31
|
+
return this;
|
32
|
+
}
|
33
|
+
/**
|
34
|
+
* If connection has been created returns it, otherwise create and then return it
|
35
|
+
*/
|
36
|
+
get(name, fresh = false) {
|
37
|
+
if (!this.registry[this._context].hasOwnProperty(name) || fresh || this.fresh[name]) {
|
38
|
+
if (!this.callbacks.hasOwnProperty(name)) {
|
39
|
+
throw new Error(`No callback named "${name}" found when trying to create connection`);
|
40
|
+
}
|
41
|
+
this.registry[this._context][name] = this.callbacks[name]();
|
42
|
+
}
|
43
|
+
return this.registry[this._context][name];
|
44
|
+
}
|
45
|
+
/**
|
46
|
+
* Set the current context
|
47
|
+
*/
|
48
|
+
context(name) {
|
49
|
+
if (!this.registry.hasOwnProperty(name)) {
|
50
|
+
this.registry[name] = {};
|
51
|
+
}
|
52
|
+
this._context = name;
|
53
|
+
return this;
|
54
|
+
}
|
55
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './Registry';
|
package/dist/models.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/**
|
2
|
+
* Helper class to generate permission strings for resources.
|
3
|
+
*/
|
4
|
+
export class Permission {
|
5
|
+
}
|
6
|
+
/**
|
7
|
+
* Generate read permission string for the provided role.
|
8
|
+
*
|
9
|
+
* @param {string} role
|
10
|
+
* @returns {string}
|
11
|
+
*/
|
12
|
+
Permission.read = (role) => {
|
13
|
+
return `read("${role}")`;
|
14
|
+
};
|
15
|
+
/**
|
16
|
+
* Generate write permission string for the provided role.
|
17
|
+
*
|
18
|
+
* This is an alias of update, delete, and possibly create.
|
19
|
+
* Don't use write in combination with update, delete, or create.
|
20
|
+
*
|
21
|
+
* @param {string} role
|
22
|
+
* @returns {string}
|
23
|
+
*/
|
24
|
+
Permission.write = (role) => {
|
25
|
+
return `write("${role}")`;
|
26
|
+
};
|
27
|
+
/**
|
28
|
+
* Generate create permission string for the provided role.
|
29
|
+
*
|
30
|
+
* @param {string} role
|
31
|
+
* @returns {string}
|
32
|
+
*/
|
33
|
+
Permission.create = (role) => {
|
34
|
+
return `create("${role}")`;
|
35
|
+
};
|
36
|
+
/**
|
37
|
+
* Generate update permission string for the provided role.
|
38
|
+
*
|
39
|
+
* @param {string} role
|
40
|
+
* @returns {string}
|
41
|
+
*/
|
42
|
+
Permission.update = (role) => {
|
43
|
+
return `update("${role}")`;
|
44
|
+
};
|
45
|
+
/**
|
46
|
+
* Generate delete permission string for the provided role.
|
47
|
+
*
|
48
|
+
* @param {string} role
|
49
|
+
* @returns {string}
|
50
|
+
*/
|
51
|
+
Permission.delete = (role) => {
|
52
|
+
return `delete("${role}")`;
|
53
|
+
};
|
package/dist/query.js
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
/**
|
2
|
+
* Helper class to generate query strings.
|
3
|
+
*/
|
4
|
+
export class Query {
|
5
|
+
/**
|
6
|
+
* Constructor for Query class.
|
7
|
+
*
|
8
|
+
* @param {string} method
|
9
|
+
* @param {AttributesTypes} attribute
|
10
|
+
* @param {QueryTypes} values
|
11
|
+
*/
|
12
|
+
constructor(method, attribute, values) {
|
13
|
+
this.method = method;
|
14
|
+
this.attribute = attribute;
|
15
|
+
if (values !== undefined) {
|
16
|
+
if (Array.isArray(values)) {
|
17
|
+
this.values = values;
|
18
|
+
}
|
19
|
+
else {
|
20
|
+
this.values = [values];
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
/**
|
25
|
+
* Convert the query object to a JSON string.
|
26
|
+
*
|
27
|
+
* @returns {string}
|
28
|
+
*/
|
29
|
+
toString() {
|
30
|
+
return JSON.stringify({
|
31
|
+
method: this.method,
|
32
|
+
attribute: this.attribute,
|
33
|
+
values: this.values,
|
34
|
+
});
|
35
|
+
}
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* Filter resources where attribute is equal to value.
|
39
|
+
*
|
40
|
+
* @param {string} attribute
|
41
|
+
* @param {QueryTypes} value
|
42
|
+
* @returns {string}
|
43
|
+
*/
|
44
|
+
Query.equal = (attribute, value) => new Query("equal", attribute, value).toString();
|
45
|
+
/**
|
46
|
+
* Filter resources where attribute is not equal to value.
|
47
|
+
*
|
48
|
+
* @param {string} attribute
|
49
|
+
* @param {QueryTypes} value
|
50
|
+
* @returns {string}
|
51
|
+
*/
|
52
|
+
Query.notEqual = (attribute, value) => new Query("notEqual", attribute, value).toString();
|
53
|
+
/**
|
54
|
+
* Filter resources where attribute is less than value.
|
55
|
+
*
|
56
|
+
* @param {string} attribute
|
57
|
+
* @param {QueryTypes} value
|
58
|
+
* @returns {string}
|
59
|
+
*/
|
60
|
+
Query.lessThan = (attribute, value) => new Query("lessThan", attribute, value).toString();
|
61
|
+
/**
|
62
|
+
* Filter resources where attribute is less than or equal to value.
|
63
|
+
*
|
64
|
+
* @param {string} attribute
|
65
|
+
* @param {QueryTypes} value
|
66
|
+
* @returns {string}
|
67
|
+
*/
|
68
|
+
Query.lessThanEqual = (attribute, value) => new Query("lessThanEqual", attribute, value).toString();
|
69
|
+
/**
|
70
|
+
* Filter resources where attribute is greater than value.
|
71
|
+
*
|
72
|
+
* @param {string} attribute
|
73
|
+
* @param {QueryTypes} value
|
74
|
+
* @returns {string}
|
75
|
+
*/
|
76
|
+
Query.greaterThan = (attribute, value) => new Query("greaterThan", attribute, value).toString();
|
77
|
+
/**
|
78
|
+
* Filter resources where attribute is greater than or equal to value.
|
79
|
+
*
|
80
|
+
* @param {string} attribute
|
81
|
+
* @param {QueryTypes} value
|
82
|
+
* @returns {string}
|
83
|
+
*/
|
84
|
+
Query.greaterThanEqual = (attribute, value) => new Query("greaterThanEqual", attribute, value).toString();
|
85
|
+
/**
|
86
|
+
* Filter resources where attribute is null.
|
87
|
+
*
|
88
|
+
* @param {string} attribute
|
89
|
+
* @returns {string}
|
90
|
+
*/
|
91
|
+
Query.isNull = (attribute) => new Query("isNull", attribute).toString();
|
92
|
+
/**
|
93
|
+
* Filter resources where attribute is not null.
|
94
|
+
*
|
95
|
+
* @param {string} attribute
|
96
|
+
* @returns {string}
|
97
|
+
*/
|
98
|
+
Query.isNotNull = (attribute) => new Query("isNotNull", attribute).toString();
|
99
|
+
/**
|
100
|
+
* Filter resources where attribute is between start and end (inclusive).
|
101
|
+
*
|
102
|
+
* @param {string} attribute
|
103
|
+
* @param {string | number} start
|
104
|
+
* @param {string | number} end
|
105
|
+
* @returns {string}
|
106
|
+
*/
|
107
|
+
Query.between = (attribute, start, end) => new Query("between", attribute, [start, end]).toString();
|
108
|
+
/**
|
109
|
+
* Filter resources where attribute starts with value.
|
110
|
+
*
|
111
|
+
* @param {string} attribute
|
112
|
+
* @param {string} value
|
113
|
+
* @returns {string}
|
114
|
+
*/
|
115
|
+
Query.startsWith = (attribute, value) => new Query("startsWith", attribute, value).toString();
|
116
|
+
/**
|
117
|
+
* Filter resources where attribute ends with value.
|
118
|
+
*
|
119
|
+
* @param {string} attribute
|
120
|
+
* @param {string} value
|
121
|
+
* @returns {string}
|
122
|
+
*/
|
123
|
+
Query.endsWith = (attribute, value) => new Query("endsWith", attribute, value).toString();
|
124
|
+
/**
|
125
|
+
* Specify which attributes should be returned by the API call.
|
126
|
+
*
|
127
|
+
* @param {string[]} attributes
|
128
|
+
* @returns {string}
|
129
|
+
*/
|
130
|
+
Query.select = (attributes) => new Query("select", undefined, attributes).toString();
|
131
|
+
/**
|
132
|
+
* Filter resources by searching attribute for value.
|
133
|
+
* A fulltext index on attribute is required for this query to work.
|
134
|
+
*
|
135
|
+
* @param {string} attribute
|
136
|
+
* @param {string} value
|
137
|
+
* @returns {string}
|
138
|
+
*/
|
139
|
+
Query.search = (attribute, value) => new Query("search", attribute, value).toString();
|
140
|
+
/**
|
141
|
+
* Sort results by attribute descending.
|
142
|
+
*
|
143
|
+
* @param {string} attribute
|
144
|
+
* @returns {string}
|
145
|
+
*/
|
146
|
+
Query.orderDesc = (attribute) => new Query("orderDesc", attribute).toString();
|
147
|
+
/**
|
148
|
+
* Sort results by attribute ascending.
|
149
|
+
*
|
150
|
+
* @param {string} attribute
|
151
|
+
* @returns {string}
|
152
|
+
*/
|
153
|
+
Query.orderAsc = (attribute) => new Query("orderAsc", attribute).toString();
|
154
|
+
/**
|
155
|
+
* Return results after documentId.
|
156
|
+
*
|
157
|
+
* @param {string} documentId
|
158
|
+
* @returns {string}
|
159
|
+
*/
|
160
|
+
Query.cursorAfter = (documentId) => new Query("cursorAfter", undefined, documentId).toString();
|
161
|
+
/**
|
162
|
+
* Return results before documentId.
|
163
|
+
*
|
164
|
+
* @param {string} documentId
|
165
|
+
* @returns {string}
|
166
|
+
*/
|
167
|
+
Query.cursorBefore = (documentId) => new Query("cursorBefore", undefined, documentId).toString();
|
168
|
+
/**
|
169
|
+
* Return only limit results.
|
170
|
+
*
|
171
|
+
* @param {number} limit
|
172
|
+
* @returns {string}
|
173
|
+
*/
|
174
|
+
Query.limit = (limit) => new Query("limit", undefined, limit).toString();
|
175
|
+
/**
|
176
|
+
* Filter resources by skipping the first offset results.
|
177
|
+
*
|
178
|
+
* @param {number} offset
|
179
|
+
* @returns {string}
|
180
|
+
*/
|
181
|
+
Query.offset = (offset) => new Query("offset", undefined, offset).toString();
|
182
|
+
/**
|
183
|
+
* Filter resources where attribute contains the specified value.
|
184
|
+
*
|
185
|
+
* @param {string} attribute
|
186
|
+
* @param {string | string[]} value
|
187
|
+
* @returns {string}
|
188
|
+
*/
|
189
|
+
Query.contains = (attribute, value) => new Query("contains", attribute, value).toString();
|
190
|
+
/**
|
191
|
+
* Combine multiple queries using logical OR operator.
|
192
|
+
*
|
193
|
+
* @param {string[]} queries
|
194
|
+
* @returns {string}
|
195
|
+
*/
|
196
|
+
Query.or = (queries) => new Query("or", undefined, queries.map((query) => JSON.parse(query))).toString();
|
197
|
+
/**
|
198
|
+
* Combine multiple queries using logical AND operator.
|
199
|
+
*
|
200
|
+
* @param {string[]} queries
|
201
|
+
* @returns {string}
|
202
|
+
*/
|
203
|
+
Query.and = (queries) => new Query("and", undefined, queries.map((query) => JSON.parse(query))).toString();
|
package/dist/role.js
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
/**
|
2
|
+
* Helper class to generate role strings for `Permission`.
|
3
|
+
*/
|
4
|
+
export class Role {
|
5
|
+
/**
|
6
|
+
* Grants access to anyone.
|
7
|
+
*
|
8
|
+
* This includes authenticated and unauthenticated users.
|
9
|
+
*
|
10
|
+
* @returns {string}
|
11
|
+
*/
|
12
|
+
static any() {
|
13
|
+
return 'any';
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Grants access to a specific user by user ID.
|
17
|
+
*
|
18
|
+
* You can optionally pass verified or unverified for
|
19
|
+
* `status` to target specific types of users.
|
20
|
+
*
|
21
|
+
* @param {string} id
|
22
|
+
* @param {string} status
|
23
|
+
* @returns {string}
|
24
|
+
*/
|
25
|
+
static user(id, status = '') {
|
26
|
+
if (status === '') {
|
27
|
+
return `user:${id}`;
|
28
|
+
}
|
29
|
+
return `user:${id}/${status}`;
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Grants access to any authenticated or anonymous user.
|
33
|
+
*
|
34
|
+
* You can optionally pass verified or unverified for
|
35
|
+
* `status` to target specific types of users.
|
36
|
+
*
|
37
|
+
* @param {string} status
|
38
|
+
* @returns {string}
|
39
|
+
*/
|
40
|
+
static users(status = '') {
|
41
|
+
if (status === '') {
|
42
|
+
return 'users';
|
43
|
+
}
|
44
|
+
return `users/${status}`;
|
45
|
+
}
|
46
|
+
/**
|
47
|
+
* Grants access to any guest user without a session.
|
48
|
+
*
|
49
|
+
* Authenticated users don't have access to this role.
|
50
|
+
*
|
51
|
+
* @returns {string}
|
52
|
+
*/
|
53
|
+
static guests() {
|
54
|
+
return 'guests';
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* Grants access to a team by team ID.
|
58
|
+
*
|
59
|
+
* You can optionally pass a role for `role` to target
|
60
|
+
* team members with the specified role.
|
61
|
+
*
|
62
|
+
* @param {string} id
|
63
|
+
* @param {string} role
|
64
|
+
* @returns {string}
|
65
|
+
*/
|
66
|
+
static team(id, role = '') {
|
67
|
+
if (role === '') {
|
68
|
+
return `team:${id}`;
|
69
|
+
}
|
70
|
+
return `team:${id}/${role}`;
|
71
|
+
}
|
72
|
+
/**
|
73
|
+
* Grants access to a specific member of a team.
|
74
|
+
*
|
75
|
+
* When the member is removed from the team, they will
|
76
|
+
* no longer have access.
|
77
|
+
*
|
78
|
+
* @param {string} id
|
79
|
+
* @returns {string}
|
80
|
+
*/
|
81
|
+
static member(id) {
|
82
|
+
return `member:${id}`;
|
83
|
+
}
|
84
|
+
/**
|
85
|
+
* Grants access to a user with the specified label.
|
86
|
+
*
|
87
|
+
* @param {string} name
|
88
|
+
* @returns {string}
|
89
|
+
*/
|
90
|
+
static label(name) {
|
91
|
+
return `label:${name}`;
|
92
|
+
}
|
93
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export class ServiceClient {
|
2
|
+
constructor(client) {
|
3
|
+
this.client = client;
|
4
|
+
}
|
5
|
+
async actionCall(actionName, payload) {
|
6
|
+
const apiPath = `/service/registry/${this.getServiceName()}/${actionName}`;
|
7
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
8
|
+
const apiHeaders = {
|
9
|
+
'content-type': 'application/json',
|
10
|
+
};
|
11
|
+
return await this.client.call('post', uri, apiHeaders, payload);
|
12
|
+
}
|
13
|
+
}
|
package/dist/service.js
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
export class Service {
|
2
|
+
constructor(client) {
|
3
|
+
this.client = client;
|
4
|
+
}
|
5
|
+
static flatten(data, prefix = '') {
|
6
|
+
let output = {};
|
7
|
+
for (const [key, value] of Object.entries(data)) {
|
8
|
+
let finalKey = prefix ? prefix + '[' + key + ']' : key;
|
9
|
+
if (Array.isArray(value)) {
|
10
|
+
output = { ...output, ...Service.flatten(value, finalKey) };
|
11
|
+
}
|
12
|
+
else {
|
13
|
+
output[finalKey] = value;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
return output;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
/**
|
20
|
+
* The size for chunked uploads in bytes.
|
21
|
+
*/
|
22
|
+
Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
|