@develit-io/backend-sdk 5.21.4 → 5.22.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/dist/index.cjs +2 -160
- package/dist/index.d.cts +7 -78
- package/dist/index.d.mts +7 -78
- package/dist/index.d.ts +7 -78
- package/dist/index.mjs +2 -157
- package/dist/infrastructure/index.cjs +193 -0
- package/dist/infrastructure/index.d.cts +148 -0
- package/dist/infrastructure/index.d.mts +148 -0
- package/dist/infrastructure/index.d.ts +148 -0
- package/dist/infrastructure/index.mjs +184 -0
- package/dist/node/index.cjs +3 -8
- package/dist/node/index.d.cts +19 -5
- package/dist/node/index.d.mts +19 -5
- package/dist/node/index.d.ts +19 -5
- package/dist/node/index.mjs +1 -10
- package/dist/shared/backend-sdk.BdcrYpFD.cjs +5 -0
- package/dist/shared/backend-sdk.CpwGFVDb.cjs +38 -0
- package/dist/shared/backend-sdk.CxCzOVpU.mjs +30 -0
- package/dist/shared/backend-sdk.DXRpnctc.mjs +3 -0
- package/dist/shared/backend-sdk._l2mbzzF.d.cts +5 -0
- package/dist/shared/backend-sdk._l2mbzzF.d.mts +5 -0
- package/dist/shared/backend-sdk._l2mbzzF.d.ts +5 -0
- package/package.json +6 -1
package/dist/index.cjs
CHANGED
|
@@ -4,8 +4,7 @@ const drizzleOrm = require('drizzle-orm');
|
|
|
4
4
|
const pgCore = require('drizzle-orm/pg-core');
|
|
5
5
|
const sqliteCore = require('drizzle-orm/sqlite-core');
|
|
6
6
|
const generalCodes = require('@develit-io/general-codes');
|
|
7
|
-
const
|
|
8
|
-
const cloudflare = require('alchemy/cloudflare');
|
|
7
|
+
const environment_consts = require('./shared/backend-sdk.BdcrYpFD.cjs');
|
|
9
8
|
const z = require('zod/v4/core');
|
|
10
9
|
require('http-status-codes');
|
|
11
10
|
const h3 = require('h3');
|
|
@@ -78,160 +77,6 @@ const bankAccountPostgres = {
|
|
|
78
77
|
countryCode: bankAccountCountryCodeEnum().$type().notNull()
|
|
79
78
|
};
|
|
80
79
|
|
|
81
|
-
const composeD1Arguments = ({
|
|
82
|
-
resourceName
|
|
83
|
-
}) => {
|
|
84
|
-
return {
|
|
85
|
-
name: resourceName,
|
|
86
|
-
primaryLocationHint: "weur"
|
|
87
|
-
// TODO: It's possible that it will take care of migrations as well
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const composeKvArguments = ({
|
|
92
|
-
resourceName
|
|
93
|
-
}) => {
|
|
94
|
-
return {
|
|
95
|
-
title: resourceName
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const composeQueueArguments = ({
|
|
100
|
-
resourceName,
|
|
101
|
-
deliveryDelay = 5,
|
|
102
|
-
messageRetentionPeriod = 259200
|
|
103
|
-
}) => {
|
|
104
|
-
return {
|
|
105
|
-
name: resourceName,
|
|
106
|
-
settings: {
|
|
107
|
-
deliveryDelay,
|
|
108
|
-
messageRetentionPeriod
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const composeR2Arguments = ({
|
|
114
|
-
resourceName,
|
|
115
|
-
storageClass = "Standard"
|
|
116
|
-
}) => {
|
|
117
|
-
return {
|
|
118
|
-
name: resourceName,
|
|
119
|
-
jurisdiction: "eu",
|
|
120
|
-
locationHint: "weur",
|
|
121
|
-
storageClass
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const composeBindingName = ({
|
|
126
|
-
resource,
|
|
127
|
-
resourceName,
|
|
128
|
-
bindingName
|
|
129
|
-
}) => {
|
|
130
|
-
const convertedBindingName = bindingName ? text.toSnakeCase(bindingName) : `${text.toSnakeCase(resourceName)}_${resource}`;
|
|
131
|
-
return convertedBindingName.toUpperCase();
|
|
132
|
-
};
|
|
133
|
-
const composeIdentifierName = ({
|
|
134
|
-
resource,
|
|
135
|
-
resourceName
|
|
136
|
-
}) => {
|
|
137
|
-
return `${resourceName}-${resource}`;
|
|
138
|
-
};
|
|
139
|
-
const composeResourceName = ({
|
|
140
|
-
project,
|
|
141
|
-
environment,
|
|
142
|
-
resourceName
|
|
143
|
-
}) => {
|
|
144
|
-
return `${project}-${resourceName}-${environment}`;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
class Infrastructure {
|
|
148
|
-
project;
|
|
149
|
-
environment;
|
|
150
|
-
constructor({
|
|
151
|
-
project,
|
|
152
|
-
environment
|
|
153
|
-
}) {
|
|
154
|
-
this.project = project;
|
|
155
|
-
this.environment = environment;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Creates an instance of Cloudflare KV.
|
|
159
|
-
*/
|
|
160
|
-
async kv(options) {
|
|
161
|
-
const { resourceName } = options;
|
|
162
|
-
return await cloudflare.KVNamespace(
|
|
163
|
-
composeIdentifierName({ resourceName, resource: "kv" }),
|
|
164
|
-
composeKvArguments({
|
|
165
|
-
resourceName: composeResourceName({
|
|
166
|
-
project: this.project,
|
|
167
|
-
environment: this.environment,
|
|
168
|
-
resourceName
|
|
169
|
-
})
|
|
170
|
-
})
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Creates an instance of Cloudflare D1.
|
|
175
|
-
*/
|
|
176
|
-
async d1(options) {
|
|
177
|
-
const { resourceName } = options;
|
|
178
|
-
return await cloudflare.D1Database(
|
|
179
|
-
composeIdentifierName({ resourceName, resource: "d1" }),
|
|
180
|
-
composeD1Arguments({
|
|
181
|
-
resourceName: composeResourceName({
|
|
182
|
-
project: this.project,
|
|
183
|
-
environment: this.environment,
|
|
184
|
-
resourceName
|
|
185
|
-
})
|
|
186
|
-
})
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Creates an instance of Cloudflare Queue.
|
|
191
|
-
*/
|
|
192
|
-
async queue(options) {
|
|
193
|
-
const { resourceName, deliveryDelay, messageRetentionPeriod } = options;
|
|
194
|
-
return await cloudflare.Queue(
|
|
195
|
-
composeIdentifierName({ resourceName, resource: "queue" }),
|
|
196
|
-
composeQueueArguments({
|
|
197
|
-
resourceName: composeResourceName({
|
|
198
|
-
project: this.project,
|
|
199
|
-
environment: this.environment,
|
|
200
|
-
resourceName
|
|
201
|
-
}),
|
|
202
|
-
deliveryDelay,
|
|
203
|
-
messageRetentionPeriod
|
|
204
|
-
})
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Creates an instance of Cloudflare R2.
|
|
209
|
-
*/
|
|
210
|
-
async r2(options) {
|
|
211
|
-
const { resourceName, storageClass } = options;
|
|
212
|
-
return await cloudflare.R2Bucket(
|
|
213
|
-
composeIdentifierName({ resourceName, resource: "r2" }),
|
|
214
|
-
composeR2Arguments({
|
|
215
|
-
resourceName: composeResourceName({
|
|
216
|
-
project: this.project,
|
|
217
|
-
environment: this.environment,
|
|
218
|
-
resourceName
|
|
219
|
-
}),
|
|
220
|
-
storageClass
|
|
221
|
-
})
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
const ENVIRONMENT = ["dev", "test", "staging", "production"];
|
|
227
|
-
|
|
228
|
-
const validateEnvironment = (environment) => {
|
|
229
|
-
if (ENVIRONMENT.includes(environment)) {
|
|
230
|
-
return environment;
|
|
231
|
-
}
|
|
232
|
-
return Number(environment);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
80
|
const ibanZodSchema = new z__namespace.$ZodString({
|
|
236
81
|
type: "string",
|
|
237
82
|
checks: [
|
|
@@ -896,9 +741,8 @@ function develitWorker(Worker) {
|
|
|
896
741
|
return DevelitWorker;
|
|
897
742
|
}
|
|
898
743
|
|
|
744
|
+
exports.ENVIRONMENT = environment_consts.ENVIRONMENT;
|
|
899
745
|
exports.DatabaseTransaction = DatabaseTransaction;
|
|
900
|
-
exports.ENVIRONMENT = ENVIRONMENT;
|
|
901
|
-
exports.Infrastructure = Infrastructure;
|
|
902
746
|
exports.RPCResponse = RPCResponse;
|
|
903
747
|
exports.action = action;
|
|
904
748
|
exports.bankAccount = bankAccount;
|
|
@@ -910,7 +754,6 @@ exports.base = base;
|
|
|
910
754
|
exports.basePostgres = basePostgres;
|
|
911
755
|
exports.calculateExponentialBackoff = calculateExponentialBackoff;
|
|
912
756
|
exports.cloudflareQueue = cloudflareQueue;
|
|
913
|
-
exports.composeBindingName = composeBindingName;
|
|
914
757
|
exports.createAuditLogWriter = createAuditLogWriter;
|
|
915
758
|
exports.createInternalError = createInternalError;
|
|
916
759
|
exports.defineCommand = defineCommand;
|
|
@@ -938,4 +781,3 @@ exports.useFetch = useFetch;
|
|
|
938
781
|
exports.useResult = useResult;
|
|
939
782
|
exports.useResultSync = useResultSync;
|
|
940
783
|
exports.uuidv4 = uuidv4;
|
|
941
|
-
exports.validateEnvironment = validateEnvironment;
|
package/dist/index.d.cts
CHANGED
|
@@ -4,11 +4,11 @@ import * as drizzle_orm from 'drizzle-orm';
|
|
|
4
4
|
import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'drizzle-orm';
|
|
5
5
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
6
6
|
import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
7
|
-
import { KVNamespace, D1Database, Queue, R2Bucket } from 'alchemy/cloudflare';
|
|
8
7
|
import * as z from 'zod/v4/core';
|
|
8
|
+
export { E as Environment, P as Project } from './shared/backend-sdk._l2mbzzF.cjs';
|
|
9
9
|
import { StatusCodes, ReasonPhrases } from 'http-status-codes';
|
|
10
10
|
export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
|
|
11
|
-
import { Queue
|
|
11
|
+
import { Queue } from '@cloudflare/workers-types';
|
|
12
12
|
import { BatchItem } from 'drizzle-orm/batch';
|
|
13
13
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
14
14
|
|
|
@@ -47,66 +47,7 @@ declare const bankAccountPostgres: {
|
|
|
47
47
|
countryCode: drizzle_orm.NotNull<drizzle_orm.$Type<drizzle_orm_pg_core.PgEnumColumnBuilderInitial<"", ["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]]>, "AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW">>;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
type Environment = number | 'dev' | 'test' | 'staging' | 'production';
|
|
53
|
-
|
|
54
|
-
declare class Infrastructure {
|
|
55
|
-
private project;
|
|
56
|
-
private environment;
|
|
57
|
-
constructor({ project, environment, }: {
|
|
58
|
-
project: Project;
|
|
59
|
-
environment: Environment;
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* Creates an instance of Cloudflare KV.
|
|
63
|
-
*/
|
|
64
|
-
kv(options: {
|
|
65
|
-
/**
|
|
66
|
-
* Name of the KV. Do not include the 'kv' prefix.
|
|
67
|
-
*/
|
|
68
|
-
resourceName: string;
|
|
69
|
-
}): Promise<KVNamespace>;
|
|
70
|
-
/**
|
|
71
|
-
* Creates an instance of Cloudflare D1.
|
|
72
|
-
*/
|
|
73
|
-
d1(options: {
|
|
74
|
-
/**
|
|
75
|
-
* Name of the D1. Do not include the 'd1' prefix.
|
|
76
|
-
*/
|
|
77
|
-
resourceName: string;
|
|
78
|
-
}): Promise<D1Database>;
|
|
79
|
-
/**
|
|
80
|
-
* Creates an instance of Cloudflare Queue.
|
|
81
|
-
*/
|
|
82
|
-
queue(options: {
|
|
83
|
-
/**
|
|
84
|
-
* Name of the Queue. Do not include the 'queue' prefix.
|
|
85
|
-
*/
|
|
86
|
-
resourceName: string;
|
|
87
|
-
/**
|
|
88
|
-
* The number of seconds to delay delivery of messages to the queue.
|
|
89
|
-
*/
|
|
90
|
-
deliveryDelay?: number;
|
|
91
|
-
/**
|
|
92
|
-
* The number of seconds a message will remain in the queue before being deleted.
|
|
93
|
-
*/
|
|
94
|
-
messageRetentionPeriod?: number;
|
|
95
|
-
}): Promise<Queue<unknown>>;
|
|
96
|
-
/**
|
|
97
|
-
* Creates an instance of Cloudflare R2.
|
|
98
|
-
*/
|
|
99
|
-
r2(options: {
|
|
100
|
-
/**
|
|
101
|
-
* Name of the R2. Do not include the 'r2' prefix.
|
|
102
|
-
*/
|
|
103
|
-
resourceName: string;
|
|
104
|
-
/**
|
|
105
|
-
* The storage class for the R2 bucket.
|
|
106
|
-
*/
|
|
107
|
-
storageClass?: 'Standard' | 'InfrequentAccess';
|
|
108
|
-
}): Promise<R2Bucket>;
|
|
109
|
-
}
|
|
50
|
+
declare const ENVIRONMENT: string[];
|
|
110
51
|
|
|
111
52
|
interface AuditLogPayload<T> {
|
|
112
53
|
action: T;
|
|
@@ -152,8 +93,6 @@ type InferResultType<Tables extends Record<string, unknown>, TableName extends k
|
|
|
152
93
|
with: With;
|
|
153
94
|
}>;
|
|
154
95
|
|
|
155
|
-
type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
|
|
156
|
-
|
|
157
96
|
declare const paginationQuerySchema: z.$ZodObject<Readonly<Readonly<{
|
|
158
97
|
[k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
|
|
159
98
|
}>>, z.$ZodObjectConfig>;
|
|
@@ -193,16 +132,6 @@ interface GatewayResponse<T> {
|
|
|
193
132
|
*/
|
|
194
133
|
type Result<T> = [data: T | null, error: InternalError | null];
|
|
195
134
|
|
|
196
|
-
declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
|
|
197
|
-
resource: Resource;
|
|
198
|
-
resourceName: string;
|
|
199
|
-
bindingName?: string;
|
|
200
|
-
}) => string;
|
|
201
|
-
|
|
202
|
-
declare const validateEnvironment: (environment: string) => Environment;
|
|
203
|
-
|
|
204
|
-
declare const ENVIRONMENT: string[];
|
|
205
|
-
|
|
206
135
|
declare const handleActionResponse: <T>({ error, status, message, data, }: {
|
|
207
136
|
error: boolean;
|
|
208
137
|
status: number;
|
|
@@ -222,8 +151,8 @@ interface DevelitWorkerMethods {
|
|
|
222
151
|
logInput(data: object): void;
|
|
223
152
|
logOutput(data: object): void;
|
|
224
153
|
logError(error: object): void;
|
|
225
|
-
pushToQueue<T>(queue: Queue
|
|
226
|
-
recordAuditLogMessage<T>(queue: Queue
|
|
154
|
+
pushToQueue<T>(queue: Queue, message: T | T[]): Promise<void>;
|
|
155
|
+
recordAuditLogMessage<T>(queue: Queue, message: T | T[]): Promise<void>;
|
|
227
156
|
handleInput<T extends z.$ZodType>(args: {
|
|
228
157
|
input: z.infer<T>;
|
|
229
158
|
schema: T;
|
|
@@ -509,5 +438,5 @@ interface WithRetryCounterOptions {
|
|
|
509
438
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
510
439
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
511
440
|
|
|
512
|
-
export { DatabaseTransaction, ENVIRONMENT,
|
|
513
|
-
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods,
|
|
441
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountPostgres, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useFetch, useResult, useResultSync, uuidv4 };
|
|
442
|
+
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, ValidatedInput };
|
package/dist/index.d.mts
CHANGED
|
@@ -4,11 +4,11 @@ import * as drizzle_orm from 'drizzle-orm';
|
|
|
4
4
|
import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'drizzle-orm';
|
|
5
5
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
6
6
|
import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
7
|
-
import { KVNamespace, D1Database, Queue, R2Bucket } from 'alchemy/cloudflare';
|
|
8
7
|
import * as z from 'zod/v4/core';
|
|
8
|
+
export { E as Environment, P as Project } from './shared/backend-sdk._l2mbzzF.mjs';
|
|
9
9
|
import { StatusCodes, ReasonPhrases } from 'http-status-codes';
|
|
10
10
|
export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
|
|
11
|
-
import { Queue
|
|
11
|
+
import { Queue } from '@cloudflare/workers-types';
|
|
12
12
|
import { BatchItem } from 'drizzle-orm/batch';
|
|
13
13
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
14
14
|
|
|
@@ -47,66 +47,7 @@ declare const bankAccountPostgres: {
|
|
|
47
47
|
countryCode: drizzle_orm.NotNull<drizzle_orm.$Type<drizzle_orm_pg_core.PgEnumColumnBuilderInitial<"", ["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]]>, "AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW">>;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
type Environment = number | 'dev' | 'test' | 'staging' | 'production';
|
|
53
|
-
|
|
54
|
-
declare class Infrastructure {
|
|
55
|
-
private project;
|
|
56
|
-
private environment;
|
|
57
|
-
constructor({ project, environment, }: {
|
|
58
|
-
project: Project;
|
|
59
|
-
environment: Environment;
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* Creates an instance of Cloudflare KV.
|
|
63
|
-
*/
|
|
64
|
-
kv(options: {
|
|
65
|
-
/**
|
|
66
|
-
* Name of the KV. Do not include the 'kv' prefix.
|
|
67
|
-
*/
|
|
68
|
-
resourceName: string;
|
|
69
|
-
}): Promise<KVNamespace>;
|
|
70
|
-
/**
|
|
71
|
-
* Creates an instance of Cloudflare D1.
|
|
72
|
-
*/
|
|
73
|
-
d1(options: {
|
|
74
|
-
/**
|
|
75
|
-
* Name of the D1. Do not include the 'd1' prefix.
|
|
76
|
-
*/
|
|
77
|
-
resourceName: string;
|
|
78
|
-
}): Promise<D1Database>;
|
|
79
|
-
/**
|
|
80
|
-
* Creates an instance of Cloudflare Queue.
|
|
81
|
-
*/
|
|
82
|
-
queue(options: {
|
|
83
|
-
/**
|
|
84
|
-
* Name of the Queue. Do not include the 'queue' prefix.
|
|
85
|
-
*/
|
|
86
|
-
resourceName: string;
|
|
87
|
-
/**
|
|
88
|
-
* The number of seconds to delay delivery of messages to the queue.
|
|
89
|
-
*/
|
|
90
|
-
deliveryDelay?: number;
|
|
91
|
-
/**
|
|
92
|
-
* The number of seconds a message will remain in the queue before being deleted.
|
|
93
|
-
*/
|
|
94
|
-
messageRetentionPeriod?: number;
|
|
95
|
-
}): Promise<Queue<unknown>>;
|
|
96
|
-
/**
|
|
97
|
-
* Creates an instance of Cloudflare R2.
|
|
98
|
-
*/
|
|
99
|
-
r2(options: {
|
|
100
|
-
/**
|
|
101
|
-
* Name of the R2. Do not include the 'r2' prefix.
|
|
102
|
-
*/
|
|
103
|
-
resourceName: string;
|
|
104
|
-
/**
|
|
105
|
-
* The storage class for the R2 bucket.
|
|
106
|
-
*/
|
|
107
|
-
storageClass?: 'Standard' | 'InfrequentAccess';
|
|
108
|
-
}): Promise<R2Bucket>;
|
|
109
|
-
}
|
|
50
|
+
declare const ENVIRONMENT: string[];
|
|
110
51
|
|
|
111
52
|
interface AuditLogPayload<T> {
|
|
112
53
|
action: T;
|
|
@@ -152,8 +93,6 @@ type InferResultType<Tables extends Record<string, unknown>, TableName extends k
|
|
|
152
93
|
with: With;
|
|
153
94
|
}>;
|
|
154
95
|
|
|
155
|
-
type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
|
|
156
|
-
|
|
157
96
|
declare const paginationQuerySchema: z.$ZodObject<Readonly<Readonly<{
|
|
158
97
|
[k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
|
|
159
98
|
}>>, z.$ZodObjectConfig>;
|
|
@@ -193,16 +132,6 @@ interface GatewayResponse<T> {
|
|
|
193
132
|
*/
|
|
194
133
|
type Result<T> = [data: T | null, error: InternalError | null];
|
|
195
134
|
|
|
196
|
-
declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
|
|
197
|
-
resource: Resource;
|
|
198
|
-
resourceName: string;
|
|
199
|
-
bindingName?: string;
|
|
200
|
-
}) => string;
|
|
201
|
-
|
|
202
|
-
declare const validateEnvironment: (environment: string) => Environment;
|
|
203
|
-
|
|
204
|
-
declare const ENVIRONMENT: string[];
|
|
205
|
-
|
|
206
135
|
declare const handleActionResponse: <T>({ error, status, message, data, }: {
|
|
207
136
|
error: boolean;
|
|
208
137
|
status: number;
|
|
@@ -222,8 +151,8 @@ interface DevelitWorkerMethods {
|
|
|
222
151
|
logInput(data: object): void;
|
|
223
152
|
logOutput(data: object): void;
|
|
224
153
|
logError(error: object): void;
|
|
225
|
-
pushToQueue<T>(queue: Queue
|
|
226
|
-
recordAuditLogMessage<T>(queue: Queue
|
|
154
|
+
pushToQueue<T>(queue: Queue, message: T | T[]): Promise<void>;
|
|
155
|
+
recordAuditLogMessage<T>(queue: Queue, message: T | T[]): Promise<void>;
|
|
227
156
|
handleInput<T extends z.$ZodType>(args: {
|
|
228
157
|
input: z.infer<T>;
|
|
229
158
|
schema: T;
|
|
@@ -509,5 +438,5 @@ interface WithRetryCounterOptions {
|
|
|
509
438
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
510
439
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
511
440
|
|
|
512
|
-
export { DatabaseTransaction, ENVIRONMENT,
|
|
513
|
-
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods,
|
|
441
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountPostgres, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useFetch, useResult, useResultSync, uuidv4 };
|
|
442
|
+
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, ValidatedInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ import * as drizzle_orm from 'drizzle-orm';
|
|
|
4
4
|
import { ExtractTablesWithRelations, DBQueryConfig, BuildQueryResult } from 'drizzle-orm';
|
|
5
5
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
6
6
|
import { AnySQLiteTable } from 'drizzle-orm/sqlite-core';
|
|
7
|
-
import { KVNamespace, D1Database, Queue, R2Bucket } from 'alchemy/cloudflare';
|
|
8
7
|
import * as z from 'zod/v4/core';
|
|
8
|
+
export { E as Environment, P as Project } from './shared/backend-sdk._l2mbzzF.js';
|
|
9
9
|
import { StatusCodes, ReasonPhrases } from 'http-status-codes';
|
|
10
10
|
export { ReasonPhrases as InternalResponsePhrase, StatusCodes as InternalResponseStatus } from 'http-status-codes';
|
|
11
|
-
import { Queue
|
|
11
|
+
import { Queue } from '@cloudflare/workers-types';
|
|
12
12
|
import { BatchItem } from 'drizzle-orm/batch';
|
|
13
13
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
14
14
|
|
|
@@ -47,66 +47,7 @@ declare const bankAccountPostgres: {
|
|
|
47
47
|
countryCode: drizzle_orm.NotNull<drizzle_orm.$Type<drizzle_orm_pg_core.PgEnumColumnBuilderInitial<"", ["AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW", ...("AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW")[]]>, "AF" | "AL" | "DZ" | "AS" | "AD" | "AO" | "AG" | "AR" | "AM" | "AW" | "AU" | "AT" | "AZ" | "BS" | "BH" | "BD" | "BB" | "BY" | "BE" | "BZ" | "BJ" | "BO" | "BQ" | "BA" | "BW" | "BR" | "IO" | "VG" | "BG" | "BF" | "BI" | "KH" | "CM" | "CA" | "CV" | "CF" | "TD" | "CL" | "CN" | "CO" | "KM" | "CK" | "CR" | "HR" | "CW" | "CY" | "CZ" | "CD" | "DK" | "DJ" | "DM" | "DO" | "TL" | "EC" | "EG" | "SV" | "GQ" | "ER" | "EE" | "ET" | "FO" | "FJ" | "FI" | "FR" | "GF" | "PF" | "GA" | "GM" | "GE" | "DE" | "GH" | "GR" | "GD" | "GP" | "GU" | "GT" | "GN" | "GW" | "GY" | "HT" | "HN" | "HU" | "IS" | "IN" | "ID" | "IR" | "IQ" | "IE" | "IM" | "IL" | "IT" | "CI" | "JM" | "JP" | "JE" | "JO" | "KZ" | "KE" | "KI" | "XK" | "KW" | "KG" | "LA" | "LV" | "LB" | "LS" | "LR" | "LI" | "LT" | "LU" | "MK" | "MG" | "MW" | "MY" | "MV" | "ML" | "MT" | "MQ" | "MR" | "MU" | "MX" | "FM" | "MD" | "MC" | "MN" | "ME" | "MS" | "MA" | "MZ" | "NA" | "NP" | "NL" | "NZ" | "NI" | "NE" | "NG" | "NU" | "NF" | "KP" | "NO" | "OM" | "PK" | "PS" | "PA" | "PG" | "PY" | "PE" | "PH" | "PL" | "PT" | "PR" | "QA" | "CG" | "RE" | "RO" | "RU" | "RW" | "BL" | "KN" | "LC" | "MF" | "VC" | "WS" | "SM" | "SA" | "SN" | "RS" | "SC" | "SL" | "SG" | "SX" | "SK" | "SI" | "SO" | "ZA" | "KR" | "SS" | "ES" | "LK" | "SD" | "SR" | "SJ" | "SZ" | "SE" | "CH" | "TW" | "TJ" | "TZ" | "TH" | "TG" | "TO" | "TT" | "TN" | "TR" | "TM" | "UM" | "VI" | "UG" | "UA" | "AE" | "GB" | "UZ" | "VU" | "VE" | "VN" | "WF" | "EH" | "YE" | "ZM" | "ZW">>;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
type Environment = number | 'dev' | 'test' | 'staging' | 'production';
|
|
53
|
-
|
|
54
|
-
declare class Infrastructure {
|
|
55
|
-
private project;
|
|
56
|
-
private environment;
|
|
57
|
-
constructor({ project, environment, }: {
|
|
58
|
-
project: Project;
|
|
59
|
-
environment: Environment;
|
|
60
|
-
});
|
|
61
|
-
/**
|
|
62
|
-
* Creates an instance of Cloudflare KV.
|
|
63
|
-
*/
|
|
64
|
-
kv(options: {
|
|
65
|
-
/**
|
|
66
|
-
* Name of the KV. Do not include the 'kv' prefix.
|
|
67
|
-
*/
|
|
68
|
-
resourceName: string;
|
|
69
|
-
}): Promise<KVNamespace>;
|
|
70
|
-
/**
|
|
71
|
-
* Creates an instance of Cloudflare D1.
|
|
72
|
-
*/
|
|
73
|
-
d1(options: {
|
|
74
|
-
/**
|
|
75
|
-
* Name of the D1. Do not include the 'd1' prefix.
|
|
76
|
-
*/
|
|
77
|
-
resourceName: string;
|
|
78
|
-
}): Promise<D1Database>;
|
|
79
|
-
/**
|
|
80
|
-
* Creates an instance of Cloudflare Queue.
|
|
81
|
-
*/
|
|
82
|
-
queue(options: {
|
|
83
|
-
/**
|
|
84
|
-
* Name of the Queue. Do not include the 'queue' prefix.
|
|
85
|
-
*/
|
|
86
|
-
resourceName: string;
|
|
87
|
-
/**
|
|
88
|
-
* The number of seconds to delay delivery of messages to the queue.
|
|
89
|
-
*/
|
|
90
|
-
deliveryDelay?: number;
|
|
91
|
-
/**
|
|
92
|
-
* The number of seconds a message will remain in the queue before being deleted.
|
|
93
|
-
*/
|
|
94
|
-
messageRetentionPeriod?: number;
|
|
95
|
-
}): Promise<Queue<unknown>>;
|
|
96
|
-
/**
|
|
97
|
-
* Creates an instance of Cloudflare R2.
|
|
98
|
-
*/
|
|
99
|
-
r2(options: {
|
|
100
|
-
/**
|
|
101
|
-
* Name of the R2. Do not include the 'r2' prefix.
|
|
102
|
-
*/
|
|
103
|
-
resourceName: string;
|
|
104
|
-
/**
|
|
105
|
-
* The storage class for the R2 bucket.
|
|
106
|
-
*/
|
|
107
|
-
storageClass?: 'Standard' | 'InfrequentAccess';
|
|
108
|
-
}): Promise<R2Bucket>;
|
|
109
|
-
}
|
|
50
|
+
declare const ENVIRONMENT: string[];
|
|
110
51
|
|
|
111
52
|
interface AuditLogPayload<T> {
|
|
112
53
|
action: T;
|
|
@@ -152,8 +93,6 @@ type InferResultType<Tables extends Record<string, unknown>, TableName extends k
|
|
|
152
93
|
with: With;
|
|
153
94
|
}>;
|
|
154
95
|
|
|
155
|
-
type Resource = 'kv' | 'd1' | 'queue' | 'r2' | 'worker' | 'service' | 'orchestrator';
|
|
156
|
-
|
|
157
96
|
declare const paginationQuerySchema: z.$ZodObject<Readonly<Readonly<{
|
|
158
97
|
[k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
|
|
159
98
|
}>>, z.$ZodObjectConfig>;
|
|
@@ -193,16 +132,6 @@ interface GatewayResponse<T> {
|
|
|
193
132
|
*/
|
|
194
133
|
type Result<T> = [data: T | null, error: InternalError | null];
|
|
195
134
|
|
|
196
|
-
declare const composeBindingName: ({ resource, resourceName, bindingName, }: {
|
|
197
|
-
resource: Resource;
|
|
198
|
-
resourceName: string;
|
|
199
|
-
bindingName?: string;
|
|
200
|
-
}) => string;
|
|
201
|
-
|
|
202
|
-
declare const validateEnvironment: (environment: string) => Environment;
|
|
203
|
-
|
|
204
|
-
declare const ENVIRONMENT: string[];
|
|
205
|
-
|
|
206
135
|
declare const handleActionResponse: <T>({ error, status, message, data, }: {
|
|
207
136
|
error: boolean;
|
|
208
137
|
status: number;
|
|
@@ -222,8 +151,8 @@ interface DevelitWorkerMethods {
|
|
|
222
151
|
logInput(data: object): void;
|
|
223
152
|
logOutput(data: object): void;
|
|
224
153
|
logError(error: object): void;
|
|
225
|
-
pushToQueue<T>(queue: Queue
|
|
226
|
-
recordAuditLogMessage<T>(queue: Queue
|
|
154
|
+
pushToQueue<T>(queue: Queue, message: T | T[]): Promise<void>;
|
|
155
|
+
recordAuditLogMessage<T>(queue: Queue, message: T | T[]): Promise<void>;
|
|
227
156
|
handleInput<T extends z.$ZodType>(args: {
|
|
228
157
|
input: z.infer<T>;
|
|
229
158
|
schema: T;
|
|
@@ -509,5 +438,5 @@ interface WithRetryCounterOptions {
|
|
|
509
438
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
510
439
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
511
440
|
|
|
512
|
-
export { DatabaseTransaction, ENVIRONMENT,
|
|
513
|
-
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods,
|
|
441
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, action, bankAccount, bankAccountBankCodeEnum, bankAccountCountryCodeEnum, bankAccountCurrencyEnum, bankAccountPostgres, base, basePostgres, calculateExponentialBackoff, cloudflareQueue, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getDrizzlePgConfig, getPgCredentials, getPgDatabaseIdFromWrangler, getPgLocalConnectionString, handleAction, handleActionResponse, ibanZodSchema, isInternalError, paginationQuerySchema, paginationSchema, service, swiftZodSchema, useFetch, useResult, useResultSync, uuidv4 };
|
|
442
|
+
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, Command, CommandLogPayload, DevelitWorkerMethods, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, ValidatedInput };
|