@develit-io/backend-sdk 7.0.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -674,6 +674,7 @@ type BuildSearchOptions = {
674
674
  declare const buildSearchConditions: (search: string | undefined | null, columns: ReadonlyArray<AnyColumn>, opts?: BuildSearchOptions) => drizzle_orm.SQL<unknown> | undefined;
675
675
  declare const buildMultiFilterConditions: <T>(column: drizzle_orm.Column, value: T | T[] | undefined) => drizzle_orm.SQL<unknown> | undefined;
676
676
  declare const buildRangeFilterConditions: <T>(column: drizzle_orm.Column, minValue: T | undefined, maxValue: T | undefined) => drizzle_orm.SQL<unknown> | undefined;
677
+ declare const resolveColumn: <T extends object, K extends Extract<keyof T, string>>(table: T, column: string | undefined, fallback?: K) => AnyColumn;
677
678
 
678
679
  interface Command<TAuditAction = string> {
679
680
  handler: (db: DrizzleD1Database<Record<string, unknown>>) => CommandItem<TAuditAction>;
@@ -821,5 +822,5 @@ interface WithRetryCounterOptions {
821
822
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
822
823
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
823
824
 
824
- export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, createSignatureKeyPair, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature };
825
+ export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, createSignatureKeyPair, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature };
825
826
  export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, AuthUser, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, UserVariables, ValidatedInput };
package/dist/index.d.ts CHANGED
@@ -674,6 +674,7 @@ type BuildSearchOptions = {
674
674
  declare const buildSearchConditions: (search: string | undefined | null, columns: ReadonlyArray<AnyColumn>, opts?: BuildSearchOptions) => drizzle_orm.SQL<unknown> | undefined;
675
675
  declare const buildMultiFilterConditions: <T>(column: drizzle_orm.Column, value: T | T[] | undefined) => drizzle_orm.SQL<unknown> | undefined;
676
676
  declare const buildRangeFilterConditions: <T>(column: drizzle_orm.Column, minValue: T | undefined, maxValue: T | undefined) => drizzle_orm.SQL<unknown> | undefined;
677
+ declare const resolveColumn: <T extends object, K extends Extract<keyof T, string>>(table: T, column: string | undefined, fallback?: K) => AnyColumn;
677
678
 
678
679
  interface Command<TAuditAction = string> {
679
680
  handler: (db: DrizzleD1Database<Record<string, unknown>>) => CommandItem<TAuditAction>;
@@ -821,5 +822,5 @@ interface WithRetryCounterOptions {
821
822
  type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
822
823
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
823
824
 
824
- export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, createSignatureKeyPair, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature };
825
+ export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, createSignatureKeyPair, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature };
825
826
  export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, AuthUser, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, UserVariables, ValidatedInput };
package/dist/index.mjs CHANGED
@@ -189,6 +189,26 @@ const paginationSchema = new z.$ZodObject({
189
189
  }
190
190
  });
191
191
 
192
+ z$1.object({
193
+ status: z$1.enum([
194
+ "queued",
195
+ // means that instance is waiting to be started (see concurrency limits)
196
+ "running",
197
+ "paused",
198
+ "errored",
199
+ "terminated",
200
+ // user terminated the instance while it was running
201
+ "complete",
202
+ "waiting",
203
+ // instance is hibernating and waiting for sleep or event to finish
204
+ "waitingForPause",
205
+ // instance is finishing the current work to pause
206
+ "unknown"
207
+ ]),
208
+ error: z$1.string().optional(),
209
+ output: z$1.unknown().optional()
210
+ });
211
+
192
212
  const handleActionResponse = ({
193
213
  error,
194
214
  status,
@@ -487,6 +507,10 @@ const buildRangeFilterConditions = (column, minValue, maxValue) => {
487
507
  if (conditions.length === 1) return conditions[0];
488
508
  return and(...conditions);
489
509
  };
510
+ const resolveColumn = (table, column, fallback = "updatedAt") => {
511
+ const key = column && column in table ? column : fallback;
512
+ return table[key];
513
+ };
490
514
 
491
515
  class DatabaseTransaction {
492
516
  constructor(db, serviceName, auditLogWriter) {
@@ -739,4 +763,4 @@ function develitWorker(Worker) {
739
763
  return DevelitWorker;
740
764
  }
741
765
 
742
- export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, service, useFetch, useResult, useResultSync, uuidv4 };
766
+ export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, paginationQuerySchema, paginationSchema, resolveColumn, service, useFetch, useResult, useResultSync, uuidv4 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "7.0.1",
3
+ "version": "8.0.0",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",