@backflow.sdk/admin 0.1.0 → 1.0.2
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 +1 -1
- package/dist/index.d.mts +47 -2
- package/dist/index.d.ts +47 -2
- package/dist/index.js +31 -3
- package/dist/index.mjs +31 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,7 @@ interface BackflowConfig {
|
|
|
23
23
|
endpoint?: string;
|
|
24
24
|
middleware?: BackflowMiddleware;
|
|
25
25
|
debug?: boolean;
|
|
26
|
+
defaultHeaders?: Record<string, string> | (() => Record<string, string>);
|
|
26
27
|
}
|
|
27
28
|
interface RequestOptions extends Omit<RequestInit, "body"> {
|
|
28
29
|
params?: Record<string, string | number | boolean | undefined>;
|
|
@@ -56,7 +57,7 @@ interface DatabaseFilter {
|
|
|
56
57
|
}
|
|
57
58
|
interface ChainedDatabaseQuery {
|
|
58
59
|
table: string;
|
|
59
|
-
operation?: 'select' | 'insert' | 'update' | 'delete';
|
|
60
|
+
operation?: 'select' | 'insert' | 'update' | 'delete' | 'increment' | 'decrement';
|
|
60
61
|
filters?: DatabaseFilter[];
|
|
61
62
|
data?: Record<string, unknown>;
|
|
62
63
|
select?: string;
|
|
@@ -68,13 +69,17 @@ interface ChainedDatabaseQuery {
|
|
|
68
69
|
limit?: number;
|
|
69
70
|
offset?: number;
|
|
70
71
|
as: string;
|
|
72
|
+
field?: string;
|
|
73
|
+
amount?: number;
|
|
71
74
|
}
|
|
72
75
|
interface DatabaseIntegrationAction {
|
|
73
76
|
type: 'database';
|
|
74
|
-
action: 'select' | 'insert' | 'update' | 'upsert' | 'delete';
|
|
77
|
+
action: 'select' | 'insert' | 'update' | 'upsert' | 'delete' | 'increment' | 'decrement';
|
|
75
78
|
table: string;
|
|
76
79
|
data?: Record<string, unknown>;
|
|
77
80
|
filters?: DatabaseFilter[];
|
|
81
|
+
field?: string;
|
|
82
|
+
amount?: number;
|
|
78
83
|
select?: string;
|
|
79
84
|
orderBy?: {
|
|
80
85
|
column: string;
|
|
@@ -1726,6 +1731,7 @@ declare class TenantResource {
|
|
|
1726
1731
|
get limits(): LimitsResource;
|
|
1727
1732
|
get workflows(): TenantWorkflowsResource;
|
|
1728
1733
|
get integrations(): TenantIntegrationsResource;
|
|
1734
|
+
get emailTemplates(): TenantEmailTemplatesResource;
|
|
1729
1735
|
get jobs(): TenantJobsResource;
|
|
1730
1736
|
get rbac(): RBACResource;
|
|
1731
1737
|
}
|
|
@@ -1919,6 +1925,45 @@ declare class TenantIntegrationsResource {
|
|
|
1919
1925
|
}>;
|
|
1920
1926
|
cloneFromDefault(integrationId: string): Promise<TenantIntegration>;
|
|
1921
1927
|
}
|
|
1928
|
+
interface TenantEmailTemplateDefinition {
|
|
1929
|
+
templateId: string;
|
|
1930
|
+
name: string;
|
|
1931
|
+
subject: string;
|
|
1932
|
+
description?: string;
|
|
1933
|
+
category: 'auth' | 'billing' | 'notification' | 'marketing' | 'custom';
|
|
1934
|
+
html?: string;
|
|
1935
|
+
variables?: string[];
|
|
1936
|
+
rendererEnabled?: boolean;
|
|
1937
|
+
providerTemplateId?: string;
|
|
1938
|
+
}
|
|
1939
|
+
interface TenantEmailTemplate {
|
|
1940
|
+
id: string;
|
|
1941
|
+
tenantId: string;
|
|
1942
|
+
templateId: string;
|
|
1943
|
+
name: string;
|
|
1944
|
+
subject: string;
|
|
1945
|
+
description?: string;
|
|
1946
|
+
category: string;
|
|
1947
|
+
variables: string[];
|
|
1948
|
+
rendererEnabled: boolean;
|
|
1949
|
+
providerTemplateId?: string | null;
|
|
1950
|
+
isActive: boolean;
|
|
1951
|
+
isDefault: boolean;
|
|
1952
|
+
version: number;
|
|
1953
|
+
html?: string;
|
|
1954
|
+
createdAt?: string;
|
|
1955
|
+
updatedAt?: string;
|
|
1956
|
+
}
|
|
1957
|
+
declare class TenantEmailTemplatesResource {
|
|
1958
|
+
private client;
|
|
1959
|
+
constructor(client: BackflowClient);
|
|
1960
|
+
list(): Promise<TenantEmailTemplate[]>;
|
|
1961
|
+
get(templateId: string): Promise<TenantEmailTemplate>;
|
|
1962
|
+
save(definition: TenantEmailTemplateDefinition): Promise<TenantEmailTemplate>;
|
|
1963
|
+
delete(templateId: string): Promise<{
|
|
1964
|
+
success: boolean;
|
|
1965
|
+
}>;
|
|
1966
|
+
}
|
|
1922
1967
|
interface TenantJobDefinition {
|
|
1923
1968
|
id: string;
|
|
1924
1969
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ interface BackflowConfig {
|
|
|
23
23
|
endpoint?: string;
|
|
24
24
|
middleware?: BackflowMiddleware;
|
|
25
25
|
debug?: boolean;
|
|
26
|
+
defaultHeaders?: Record<string, string> | (() => Record<string, string>);
|
|
26
27
|
}
|
|
27
28
|
interface RequestOptions extends Omit<RequestInit, "body"> {
|
|
28
29
|
params?: Record<string, string | number | boolean | undefined>;
|
|
@@ -56,7 +57,7 @@ interface DatabaseFilter {
|
|
|
56
57
|
}
|
|
57
58
|
interface ChainedDatabaseQuery {
|
|
58
59
|
table: string;
|
|
59
|
-
operation?: 'select' | 'insert' | 'update' | 'delete';
|
|
60
|
+
operation?: 'select' | 'insert' | 'update' | 'delete' | 'increment' | 'decrement';
|
|
60
61
|
filters?: DatabaseFilter[];
|
|
61
62
|
data?: Record<string, unknown>;
|
|
62
63
|
select?: string;
|
|
@@ -68,13 +69,17 @@ interface ChainedDatabaseQuery {
|
|
|
68
69
|
limit?: number;
|
|
69
70
|
offset?: number;
|
|
70
71
|
as: string;
|
|
72
|
+
field?: string;
|
|
73
|
+
amount?: number;
|
|
71
74
|
}
|
|
72
75
|
interface DatabaseIntegrationAction {
|
|
73
76
|
type: 'database';
|
|
74
|
-
action: 'select' | 'insert' | 'update' | 'upsert' | 'delete';
|
|
77
|
+
action: 'select' | 'insert' | 'update' | 'upsert' | 'delete' | 'increment' | 'decrement';
|
|
75
78
|
table: string;
|
|
76
79
|
data?: Record<string, unknown>;
|
|
77
80
|
filters?: DatabaseFilter[];
|
|
81
|
+
field?: string;
|
|
82
|
+
amount?: number;
|
|
78
83
|
select?: string;
|
|
79
84
|
orderBy?: {
|
|
80
85
|
column: string;
|
|
@@ -1726,6 +1731,7 @@ declare class TenantResource {
|
|
|
1726
1731
|
get limits(): LimitsResource;
|
|
1727
1732
|
get workflows(): TenantWorkflowsResource;
|
|
1728
1733
|
get integrations(): TenantIntegrationsResource;
|
|
1734
|
+
get emailTemplates(): TenantEmailTemplatesResource;
|
|
1729
1735
|
get jobs(): TenantJobsResource;
|
|
1730
1736
|
get rbac(): RBACResource;
|
|
1731
1737
|
}
|
|
@@ -1919,6 +1925,45 @@ declare class TenantIntegrationsResource {
|
|
|
1919
1925
|
}>;
|
|
1920
1926
|
cloneFromDefault(integrationId: string): Promise<TenantIntegration>;
|
|
1921
1927
|
}
|
|
1928
|
+
interface TenantEmailTemplateDefinition {
|
|
1929
|
+
templateId: string;
|
|
1930
|
+
name: string;
|
|
1931
|
+
subject: string;
|
|
1932
|
+
description?: string;
|
|
1933
|
+
category: 'auth' | 'billing' | 'notification' | 'marketing' | 'custom';
|
|
1934
|
+
html?: string;
|
|
1935
|
+
variables?: string[];
|
|
1936
|
+
rendererEnabled?: boolean;
|
|
1937
|
+
providerTemplateId?: string;
|
|
1938
|
+
}
|
|
1939
|
+
interface TenantEmailTemplate {
|
|
1940
|
+
id: string;
|
|
1941
|
+
tenantId: string;
|
|
1942
|
+
templateId: string;
|
|
1943
|
+
name: string;
|
|
1944
|
+
subject: string;
|
|
1945
|
+
description?: string;
|
|
1946
|
+
category: string;
|
|
1947
|
+
variables: string[];
|
|
1948
|
+
rendererEnabled: boolean;
|
|
1949
|
+
providerTemplateId?: string | null;
|
|
1950
|
+
isActive: boolean;
|
|
1951
|
+
isDefault: boolean;
|
|
1952
|
+
version: number;
|
|
1953
|
+
html?: string;
|
|
1954
|
+
createdAt?: string;
|
|
1955
|
+
updatedAt?: string;
|
|
1956
|
+
}
|
|
1957
|
+
declare class TenantEmailTemplatesResource {
|
|
1958
|
+
private client;
|
|
1959
|
+
constructor(client: BackflowClient);
|
|
1960
|
+
list(): Promise<TenantEmailTemplate[]>;
|
|
1961
|
+
get(templateId: string): Promise<TenantEmailTemplate>;
|
|
1962
|
+
save(definition: TenantEmailTemplateDefinition): Promise<TenantEmailTemplate>;
|
|
1963
|
+
delete(templateId: string): Promise<{
|
|
1964
|
+
success: boolean;
|
|
1965
|
+
}>;
|
|
1966
|
+
}
|
|
1922
1967
|
interface TenantJobDefinition {
|
|
1923
1968
|
id: string;
|
|
1924
1969
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -177,8 +177,10 @@ var BackflowClient = class {
|
|
|
177
177
|
url += `?${queryString}`;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
+
const defaultHeaders = typeof this.config.defaultHeaders === "function" ? this.config.defaultHeaders() : this.config.defaultHeaders;
|
|
180
181
|
const headers = {
|
|
181
182
|
"Content-Type": "application/json",
|
|
183
|
+
...defaultHeaders || {},
|
|
182
184
|
...fetchOptions.headers || {}
|
|
183
185
|
};
|
|
184
186
|
const token = await this.getToken();
|
|
@@ -270,7 +272,10 @@ var BackflowClient = class {
|
|
|
270
272
|
});
|
|
271
273
|
}
|
|
272
274
|
const url = `${this.config.endpoint}${path}`;
|
|
273
|
-
const
|
|
275
|
+
const defaultHeaders = typeof this.config.defaultHeaders === "function" ? this.config.defaultHeaders() : this.config.defaultHeaders;
|
|
276
|
+
const uploadHeaders = {
|
|
277
|
+
...defaultHeaders || {}
|
|
278
|
+
};
|
|
274
279
|
const token = await this.getToken();
|
|
275
280
|
if (token) {
|
|
276
281
|
uploadHeaders["Authorization"] = `Bearer ${token}`;
|
|
@@ -2255,18 +2260,20 @@ var FilesResource2 = class {
|
|
|
2255
2260
|
this.client = client;
|
|
2256
2261
|
}
|
|
2257
2262
|
async upload(file, options = {}) {
|
|
2258
|
-
|
|
2263
|
+
const response = await this.client.upload("/files/upload", file, {
|
|
2259
2264
|
bucket: options.bucket || "squeed-storage",
|
|
2260
2265
|
entityType: options.entityType || "project",
|
|
2261
2266
|
entityId: options.entityId || "default"
|
|
2262
2267
|
});
|
|
2268
|
+
return response.file;
|
|
2263
2269
|
}
|
|
2264
2270
|
async uploadMultiple(files, options = {}) {
|
|
2265
|
-
|
|
2271
|
+
const response = await this.client.upload("/files/upload-multiple", files, {
|
|
2266
2272
|
bucket: options.bucket || "squeed-storage",
|
|
2267
2273
|
entityType: options.entityType || "project",
|
|
2268
2274
|
entityId: options.entityId || "default"
|
|
2269
2275
|
});
|
|
2276
|
+
return response.files;
|
|
2270
2277
|
}
|
|
2271
2278
|
async list(entityType, entityId, options) {
|
|
2272
2279
|
const params = {};
|
|
@@ -2830,6 +2837,9 @@ var TenantResource = class {
|
|
|
2830
2837
|
get integrations() {
|
|
2831
2838
|
return new TenantIntegrationsResource2(this.client);
|
|
2832
2839
|
}
|
|
2840
|
+
get emailTemplates() {
|
|
2841
|
+
return new TenantEmailTemplatesResource(this.client);
|
|
2842
|
+
}
|
|
2833
2843
|
get jobs() {
|
|
2834
2844
|
return new TenantJobsResource2(this.client);
|
|
2835
2845
|
}
|
|
@@ -3092,6 +3102,24 @@ var TenantIntegrationsResource2 = class {
|
|
|
3092
3102
|
return this.client.post(`/tenant/integrations/${encodeURIComponent(integrationId)}/clone`);
|
|
3093
3103
|
}
|
|
3094
3104
|
};
|
|
3105
|
+
var TenantEmailTemplatesResource = class {
|
|
3106
|
+
constructor(client) {
|
|
3107
|
+
this.client = client;
|
|
3108
|
+
}
|
|
3109
|
+
async list() {
|
|
3110
|
+
const response = await this.client.get("/tenant/email-templates");
|
|
3111
|
+
return response.templates || [];
|
|
3112
|
+
}
|
|
3113
|
+
async get(templateId) {
|
|
3114
|
+
return this.client.get(`/tenant/email-templates/${encodeURIComponent(templateId)}`);
|
|
3115
|
+
}
|
|
3116
|
+
async save(definition) {
|
|
3117
|
+
return this.client.post("/tenant/email-templates", definition);
|
|
3118
|
+
}
|
|
3119
|
+
async delete(templateId) {
|
|
3120
|
+
return this.client.delete(`/tenant/email-templates/${encodeURIComponent(templateId)}`);
|
|
3121
|
+
}
|
|
3122
|
+
};
|
|
3095
3123
|
var TenantJobsResource2 = class {
|
|
3096
3124
|
constructor(client) {
|
|
3097
3125
|
this.client = client;
|
package/dist/index.mjs
CHANGED
|
@@ -82,8 +82,10 @@ var BackflowClient = class {
|
|
|
82
82
|
url += `?${queryString}`;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
const defaultHeaders = typeof this.config.defaultHeaders === "function" ? this.config.defaultHeaders() : this.config.defaultHeaders;
|
|
85
86
|
const headers = {
|
|
86
87
|
"Content-Type": "application/json",
|
|
88
|
+
...defaultHeaders || {},
|
|
87
89
|
...fetchOptions.headers || {}
|
|
88
90
|
};
|
|
89
91
|
const token = await this.getToken();
|
|
@@ -175,7 +177,10 @@ var BackflowClient = class {
|
|
|
175
177
|
});
|
|
176
178
|
}
|
|
177
179
|
const url = `${this.config.endpoint}${path}`;
|
|
178
|
-
const
|
|
180
|
+
const defaultHeaders = typeof this.config.defaultHeaders === "function" ? this.config.defaultHeaders() : this.config.defaultHeaders;
|
|
181
|
+
const uploadHeaders = {
|
|
182
|
+
...defaultHeaders || {}
|
|
183
|
+
};
|
|
179
184
|
const token = await this.getToken();
|
|
180
185
|
if (token) {
|
|
181
186
|
uploadHeaders["Authorization"] = `Bearer ${token}`;
|
|
@@ -2160,18 +2165,20 @@ var FilesResource2 = class {
|
|
|
2160
2165
|
this.client = client;
|
|
2161
2166
|
}
|
|
2162
2167
|
async upload(file, options = {}) {
|
|
2163
|
-
|
|
2168
|
+
const response = await this.client.upload("/files/upload", file, {
|
|
2164
2169
|
bucket: options.bucket || "squeed-storage",
|
|
2165
2170
|
entityType: options.entityType || "project",
|
|
2166
2171
|
entityId: options.entityId || "default"
|
|
2167
2172
|
});
|
|
2173
|
+
return response.file;
|
|
2168
2174
|
}
|
|
2169
2175
|
async uploadMultiple(files, options = {}) {
|
|
2170
|
-
|
|
2176
|
+
const response = await this.client.upload("/files/upload-multiple", files, {
|
|
2171
2177
|
bucket: options.bucket || "squeed-storage",
|
|
2172
2178
|
entityType: options.entityType || "project",
|
|
2173
2179
|
entityId: options.entityId || "default"
|
|
2174
2180
|
});
|
|
2181
|
+
return response.files;
|
|
2175
2182
|
}
|
|
2176
2183
|
async list(entityType, entityId, options) {
|
|
2177
2184
|
const params = {};
|
|
@@ -2735,6 +2742,9 @@ var TenantResource = class {
|
|
|
2735
2742
|
get integrations() {
|
|
2736
2743
|
return new TenantIntegrationsResource2(this.client);
|
|
2737
2744
|
}
|
|
2745
|
+
get emailTemplates() {
|
|
2746
|
+
return new TenantEmailTemplatesResource(this.client);
|
|
2747
|
+
}
|
|
2738
2748
|
get jobs() {
|
|
2739
2749
|
return new TenantJobsResource2(this.client);
|
|
2740
2750
|
}
|
|
@@ -2997,6 +3007,24 @@ var TenantIntegrationsResource2 = class {
|
|
|
2997
3007
|
return this.client.post(`/tenant/integrations/${encodeURIComponent(integrationId)}/clone`);
|
|
2998
3008
|
}
|
|
2999
3009
|
};
|
|
3010
|
+
var TenantEmailTemplatesResource = class {
|
|
3011
|
+
constructor(client) {
|
|
3012
|
+
this.client = client;
|
|
3013
|
+
}
|
|
3014
|
+
async list() {
|
|
3015
|
+
const response = await this.client.get("/tenant/email-templates");
|
|
3016
|
+
return response.templates || [];
|
|
3017
|
+
}
|
|
3018
|
+
async get(templateId) {
|
|
3019
|
+
return this.client.get(`/tenant/email-templates/${encodeURIComponent(templateId)}`);
|
|
3020
|
+
}
|
|
3021
|
+
async save(definition) {
|
|
3022
|
+
return this.client.post("/tenant/email-templates", definition);
|
|
3023
|
+
}
|
|
3024
|
+
async delete(templateId) {
|
|
3025
|
+
return this.client.delete(`/tenant/email-templates/${encodeURIComponent(templateId)}`);
|
|
3026
|
+
}
|
|
3027
|
+
};
|
|
3000
3028
|
var TenantJobsResource2 = class {
|
|
3001
3029
|
constructor(client) {
|
|
3002
3030
|
this.client = client;
|