@develit-io/backend-sdk 9.0.0 → 9.0.1

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
@@ -74,13 +74,6 @@ interface AuditLogPayload<T> {
74
74
  entityId?: string;
75
75
  }
76
76
 
77
- interface AuthUser {
78
- id: string;
79
- organizationId: string;
80
- email: string;
81
- role: UserRole;
82
- }
83
-
84
77
  declare const ibanSchema: z$1.ZodString;
85
78
  declare const bicSchema: z$1.ZodString;
86
79
  declare const bankAccountMetadataSchema: z$1.ZodObject<{
@@ -415,6 +408,26 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
415
408
  interface BankAccountMetadata extends z$1.infer<typeof bankAccountMetadataSchema> {
416
409
  }
417
410
 
411
+ declare const workflowInstanceStatusSchema: z$1.ZodObject<{
412
+ status: z$1.ZodEnum<{
413
+ unknown: "unknown";
414
+ queued: "queued";
415
+ running: "running";
416
+ paused: "paused";
417
+ errored: "errored";
418
+ terminated: "terminated";
419
+ complete: "complete";
420
+ waiting: "waiting";
421
+ waitingForPause: "waitingForPause";
422
+ }>;
423
+ error: z$1.ZodOptional<z$1.ZodObject<{
424
+ message: z$1.ZodString;
425
+ name: z$1.ZodOptional<z$1.ZodString>;
426
+ }, z$1.core.$strip>>;
427
+ output: z$1.ZodOptional<z$1.ZodUnknown>;
428
+ }, z$1.core.$strip>;
429
+ type WorkflowInstanceStatus = z$1.infer<typeof workflowInstanceStatusSchema>;
430
+
418
431
  interface CommandLogPayload<T = string> {
419
432
  action: T;
420
433
  actorId: string;
@@ -448,16 +461,6 @@ type InferResultType<Tables extends Record<string, unknown>, TableName extends k
448
461
  with: With;
449
462
  }>;
450
463
 
451
- interface IdempotencyVariables {
452
- idempotency: {
453
- key: string;
454
- };
455
- }
456
- interface UserVariables {
457
- user: AuthUser;
458
- jwt: unknown;
459
- }
460
-
461
464
  declare const paginationQuerySchema: z.$ZodObject<Readonly<Readonly<{
462
465
  [k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
463
466
  }>>, z.$ZodObjectConfig>;
@@ -465,6 +468,19 @@ declare const paginationSchema: z.$ZodObject<Readonly<Readonly<{
465
468
  [k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
466
469
  }>>, z.$ZodObjectConfig>;
467
470
 
471
+ interface BaseEvent {
472
+ metadata: {
473
+ timestamp: string;
474
+ correlationId: string;
475
+ entityId: string;
476
+ /**
477
+ * Idempotency key is built as
478
+ * `${entityId}-${eventSignal}-${idempotencySuffix}`
479
+ */
480
+ idempotencySuffix?: string;
481
+ };
482
+ }
483
+
468
484
  type InternalErrorResponseStatus = Exclude<ContentfulStatusCode, SuccessStatusCode>;
469
485
  interface InternalError {
470
486
  status: InternalErrorResponseStatus;
@@ -497,39 +513,6 @@ interface GatewayResponse<T> {
497
513
  */
498
514
  type Result<T> = [data: T | null, error: InternalError | null];
499
515
 
500
- interface BaseEvent {
501
- metadata: {
502
- timestamp: string;
503
- correlationId: string;
504
- entityId: string;
505
- /**
506
- * Idempotency key is built as
507
- * `${entityId}-${eventSignal}-${idempotencySuffix}`
508
- */
509
- idempotencySuffix?: string;
510
- };
511
- }
512
-
513
- declare const workflowInstanceStatusSchema: z$1.ZodObject<{
514
- status: z$1.ZodEnum<{
515
- unknown: "unknown";
516
- queued: "queued";
517
- running: "running";
518
- paused: "paused";
519
- errored: "errored";
520
- terminated: "terminated";
521
- complete: "complete";
522
- waiting: "waiting";
523
- waitingForPause: "waitingForPause";
524
- }>;
525
- error: z$1.ZodOptional<z$1.ZodObject<{
526
- message: z$1.ZodString;
527
- name: z$1.ZodOptional<z$1.ZodString>;
528
- }, z$1.core.$strip>>;
529
- output: z$1.ZodOptional<z$1.ZodUnknown>;
530
- }, z$1.core.$strip>;
531
- type WorkflowInstanceStatus = z$1.infer<typeof workflowInstanceStatusSchema>;
532
-
533
516
  type Constructor<T = {}> = abstract new (...args: any[]) => T;
534
517
  interface DevelitWorkerMethods {
535
518
  name: string;
@@ -848,4 +831,4 @@ type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...a
848
831
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
849
832
 
850
833
  export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, createSignatureKeyPair, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature, workflowInstanceStatusSchema };
851
- export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, AuthUser, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, UserVariables, ValidatedInput, WorkflowInstanceStatus };
834
+ export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, ValidatedInput, WorkflowInstanceStatus };
package/dist/index.d.ts CHANGED
@@ -74,13 +74,6 @@ interface AuditLogPayload<T> {
74
74
  entityId?: string;
75
75
  }
76
76
 
77
- interface AuthUser {
78
- id: string;
79
- organizationId: string;
80
- email: string;
81
- role: UserRole;
82
- }
83
-
84
77
  declare const ibanSchema: z$1.ZodString;
85
78
  declare const bicSchema: z$1.ZodString;
86
79
  declare const bankAccountMetadataSchema: z$1.ZodObject<{
@@ -415,6 +408,26 @@ declare const bankAccountMetadataSchema: z$1.ZodObject<{
415
408
  interface BankAccountMetadata extends z$1.infer<typeof bankAccountMetadataSchema> {
416
409
  }
417
410
 
411
+ declare const workflowInstanceStatusSchema: z$1.ZodObject<{
412
+ status: z$1.ZodEnum<{
413
+ unknown: "unknown";
414
+ queued: "queued";
415
+ running: "running";
416
+ paused: "paused";
417
+ errored: "errored";
418
+ terminated: "terminated";
419
+ complete: "complete";
420
+ waiting: "waiting";
421
+ waitingForPause: "waitingForPause";
422
+ }>;
423
+ error: z$1.ZodOptional<z$1.ZodObject<{
424
+ message: z$1.ZodString;
425
+ name: z$1.ZodOptional<z$1.ZodString>;
426
+ }, z$1.core.$strip>>;
427
+ output: z$1.ZodOptional<z$1.ZodUnknown>;
428
+ }, z$1.core.$strip>;
429
+ type WorkflowInstanceStatus = z$1.infer<typeof workflowInstanceStatusSchema>;
430
+
418
431
  interface CommandLogPayload<T = string> {
419
432
  action: T;
420
433
  actorId: string;
@@ -448,16 +461,6 @@ type InferResultType<Tables extends Record<string, unknown>, TableName extends k
448
461
  with: With;
449
462
  }>;
450
463
 
451
- interface IdempotencyVariables {
452
- idempotency: {
453
- key: string;
454
- };
455
- }
456
- interface UserVariables {
457
- user: AuthUser;
458
- jwt: unknown;
459
- }
460
-
461
464
  declare const paginationQuerySchema: z.$ZodObject<Readonly<Readonly<{
462
465
  [k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
463
466
  }>>, z.$ZodObjectConfig>;
@@ -465,6 +468,19 @@ declare const paginationSchema: z.$ZodObject<Readonly<Readonly<{
465
468
  [k: string]: z.$ZodType<unknown, unknown, z.$ZodTypeInternals<unknown, unknown>>;
466
469
  }>>, z.$ZodObjectConfig>;
467
470
 
471
+ interface BaseEvent {
472
+ metadata: {
473
+ timestamp: string;
474
+ correlationId: string;
475
+ entityId: string;
476
+ /**
477
+ * Idempotency key is built as
478
+ * `${entityId}-${eventSignal}-${idempotencySuffix}`
479
+ */
480
+ idempotencySuffix?: string;
481
+ };
482
+ }
483
+
468
484
  type InternalErrorResponseStatus = Exclude<ContentfulStatusCode, SuccessStatusCode>;
469
485
  interface InternalError {
470
486
  status: InternalErrorResponseStatus;
@@ -497,39 +513,6 @@ interface GatewayResponse<T> {
497
513
  */
498
514
  type Result<T> = [data: T | null, error: InternalError | null];
499
515
 
500
- interface BaseEvent {
501
- metadata: {
502
- timestamp: string;
503
- correlationId: string;
504
- entityId: string;
505
- /**
506
- * Idempotency key is built as
507
- * `${entityId}-${eventSignal}-${idempotencySuffix}`
508
- */
509
- idempotencySuffix?: string;
510
- };
511
- }
512
-
513
- declare const workflowInstanceStatusSchema: z$1.ZodObject<{
514
- status: z$1.ZodEnum<{
515
- unknown: "unknown";
516
- queued: "queued";
517
- running: "running";
518
- paused: "paused";
519
- errored: "errored";
520
- terminated: "terminated";
521
- complete: "complete";
522
- waiting: "waiting";
523
- waitingForPause: "waitingForPause";
524
- }>;
525
- error: z$1.ZodOptional<z$1.ZodObject<{
526
- message: z$1.ZodString;
527
- name: z$1.ZodOptional<z$1.ZodString>;
528
- }, z$1.core.$strip>>;
529
- output: z$1.ZodOptional<z$1.ZodUnknown>;
530
- }, z$1.core.$strip>;
531
- type WorkflowInstanceStatus = z$1.infer<typeof workflowInstanceStatusSchema>;
532
-
533
516
  type Constructor<T = {}> = abstract new (...args: any[]) => T;
534
517
  interface DevelitWorkerMethods {
535
518
  name: string;
@@ -848,4 +831,4 @@ type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...a
848
831
  declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
849
832
 
850
833
  export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, createSignatureKeyPair, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature, workflowInstanceStatusSchema };
851
- export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, AuthUser, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, UserVariables, ValidatedInput, WorkflowInstanceStatus };
834
+ export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, ValidatedInput, WorkflowInstanceStatus };
package/dist/index.mjs CHANGED
@@ -103,6 +103,29 @@ const bankAccountMetadataSchema = z$1.object({
103
103
  // Brazil
104
104
  });
105
105
 
106
+ const workflowInstanceStatusSchema = z$1.object({
107
+ status: z$1.enum([
108
+ "queued",
109
+ // means that instance is waiting to be started (see concurrency limits)
110
+ "running",
111
+ "paused",
112
+ "errored",
113
+ "terminated",
114
+ // user terminated the instance while it was running
115
+ "complete",
116
+ "waiting",
117
+ // instance is hibernating and waiting for sleep or event to finish
118
+ "waitingForPause",
119
+ // instance is finishing the current work to pause
120
+ "unknown"
121
+ ]),
122
+ error: z$1.object({
123
+ message: z$1.string(),
124
+ name: z$1.string().optional()
125
+ }).optional(),
126
+ output: z$1.unknown().optional()
127
+ });
128
+
106
129
  const paginationQuerySchema = new z.$ZodObject({
107
130
  type: "object",
108
131
  shape: {
@@ -188,29 +211,6 @@ const paginationSchema = new z.$ZodObject({
188
211
  }
189
212
  });
190
213
 
191
- const workflowInstanceStatusSchema = z$1.object({
192
- status: z$1.enum([
193
- "queued",
194
- // means that instance is waiting to be started (see concurrency limits)
195
- "running",
196
- "paused",
197
- "errored",
198
- "terminated",
199
- // user terminated the instance while it was running
200
- "complete",
201
- "waiting",
202
- // instance is hibernating and waiting for sleep or event to finish
203
- "waitingForPause",
204
- // instance is finishing the current work to pause
205
- "unknown"
206
- ]),
207
- error: z$1.object({
208
- message: z$1.string(),
209
- name: z$1.string().optional()
210
- }).optional(),
211
- output: z$1.unknown().optional()
212
- });
213
-
214
214
  const createInternalError = (error, details) => {
215
215
  return {
216
216
  status: details?.status || 500,
@@ -1,13 +1,99 @@
1
- import { MiddlewareHandler } from 'hono/types';
1
+ import * as hono_types from 'hono/types';
2
2
 
3
- declare const idempotency: () => MiddlewareHandler;
3
+ declare const idempotency: () => hono_types.MiddlewareHandler<{
4
+ Variables: {
5
+ idempotency: {
6
+ key: string;
7
+ };
8
+ };
9
+ Bindings: {
10
+ IDEMPOTENCY_KV: KVNamespace;
11
+ };
12
+ }, string, {}, Response>;
4
13
 
5
- declare const jwt: () => MiddlewareHandler;
14
+ type AuthService = {
15
+ verifyAccessToken: (params: {
16
+ accessToken: string;
17
+ }) => Promise<{
18
+ data?: {
19
+ payload: {
20
+ user: {
21
+ email: string;
22
+ role: string;
23
+ rawUserMetaData: string | null;
24
+ };
25
+ };
26
+ };
27
+ error?: unknown;
28
+ }>;
29
+ };
30
+ declare const jwt: () => hono_types.MiddlewareHandler<{
31
+ Variables: {
32
+ user: {
33
+ email: string;
34
+ role: string;
35
+ organizationId: string;
36
+ };
37
+ };
38
+ Bindings: {
39
+ AUTH_SERVICE: AuthService;
40
+ };
41
+ }, string, {}, Response>;
6
42
 
7
- declare const ip: () => MiddlewareHandler;
43
+ type OrganizationService$1 = {
44
+ getOrganization: (params: {
45
+ organizationId: string;
46
+ }) => Promise<{
47
+ data: {
48
+ id: string;
49
+ ipAuthorization: boolean;
50
+ authorizedIps: {
51
+ ip: string;
52
+ }[];
53
+ } | null | undefined;
54
+ error: boolean;
55
+ }>;
56
+ };
57
+ declare const ip: () => hono_types.MiddlewareHandler<{
58
+ Variables: {
59
+ user: {
60
+ organizationId: string;
61
+ };
62
+ };
63
+ Bindings: {
64
+ ENVIRONMENT: string;
65
+ ORGANIZATION_SERVICE: OrganizationService$1;
66
+ };
67
+ }, string, {}, Response>;
8
68
 
9
- declare const logger: () => MiddlewareHandler;
69
+ declare const logger: () => hono_types.MiddlewareHandler<any, string, {}, Response>;
10
70
 
11
- declare const signature: () => MiddlewareHandler;
71
+ type OrganizationService = {
72
+ getOrganization: (params: {
73
+ organizationId: string;
74
+ }) => Promise<{
75
+ data: {
76
+ id: string;
77
+ signatureKeys: {
78
+ name: string;
79
+ publicKey: string;
80
+ }[];
81
+ } | null | undefined;
82
+ error: boolean;
83
+ }>;
84
+ };
85
+ declare const signature: () => hono_types.MiddlewareHandler<{
86
+ Variables: {
87
+ user: {
88
+ email: string;
89
+ role: string;
90
+ organizationId: string;
91
+ };
92
+ };
93
+ Bindings: {
94
+ ENVIRONMENT: string;
95
+ ORGANIZATION_SERVICE: OrganizationService;
96
+ };
97
+ }, string, {}, Response>;
12
98
 
13
99
  export { idempotency, ip, jwt, logger, signature };
@@ -1,13 +1,99 @@
1
- import { MiddlewareHandler } from 'hono/types';
1
+ import * as hono_types from 'hono/types';
2
2
 
3
- declare const idempotency: () => MiddlewareHandler;
3
+ declare const idempotency: () => hono_types.MiddlewareHandler<{
4
+ Variables: {
5
+ idempotency: {
6
+ key: string;
7
+ };
8
+ };
9
+ Bindings: {
10
+ IDEMPOTENCY_KV: KVNamespace;
11
+ };
12
+ }, string, {}, Response>;
4
13
 
5
- declare const jwt: () => MiddlewareHandler;
14
+ type AuthService = {
15
+ verifyAccessToken: (params: {
16
+ accessToken: string;
17
+ }) => Promise<{
18
+ data?: {
19
+ payload: {
20
+ user: {
21
+ email: string;
22
+ role: string;
23
+ rawUserMetaData: string | null;
24
+ };
25
+ };
26
+ };
27
+ error?: unknown;
28
+ }>;
29
+ };
30
+ declare const jwt: () => hono_types.MiddlewareHandler<{
31
+ Variables: {
32
+ user: {
33
+ email: string;
34
+ role: string;
35
+ organizationId: string;
36
+ };
37
+ };
38
+ Bindings: {
39
+ AUTH_SERVICE: AuthService;
40
+ };
41
+ }, string, {}, Response>;
6
42
 
7
- declare const ip: () => MiddlewareHandler;
43
+ type OrganizationService$1 = {
44
+ getOrganization: (params: {
45
+ organizationId: string;
46
+ }) => Promise<{
47
+ data: {
48
+ id: string;
49
+ ipAuthorization: boolean;
50
+ authorizedIps: {
51
+ ip: string;
52
+ }[];
53
+ } | null | undefined;
54
+ error: boolean;
55
+ }>;
56
+ };
57
+ declare const ip: () => hono_types.MiddlewareHandler<{
58
+ Variables: {
59
+ user: {
60
+ organizationId: string;
61
+ };
62
+ };
63
+ Bindings: {
64
+ ENVIRONMENT: string;
65
+ ORGANIZATION_SERVICE: OrganizationService$1;
66
+ };
67
+ }, string, {}, Response>;
8
68
 
9
- declare const logger: () => MiddlewareHandler;
69
+ declare const logger: () => hono_types.MiddlewareHandler<any, string, {}, Response>;
10
70
 
11
- declare const signature: () => MiddlewareHandler;
71
+ type OrganizationService = {
72
+ getOrganization: (params: {
73
+ organizationId: string;
74
+ }) => Promise<{
75
+ data: {
76
+ id: string;
77
+ signatureKeys: {
78
+ name: string;
79
+ publicKey: string;
80
+ }[];
81
+ } | null | undefined;
82
+ error: boolean;
83
+ }>;
84
+ };
85
+ declare const signature: () => hono_types.MiddlewareHandler<{
86
+ Variables: {
87
+ user: {
88
+ email: string;
89
+ role: string;
90
+ organizationId: string;
91
+ };
92
+ };
93
+ Bindings: {
94
+ ENVIRONMENT: string;
95
+ ORGANIZATION_SERVICE: OrganizationService;
96
+ };
97
+ }, string, {}, Response>;
12
98
 
13
99
  export { idempotency, ip, jwt, logger, signature };
@@ -28,10 +28,10 @@ const logResponse = (log) => {
28
28
 
29
29
  const idempotency = () => {
30
30
  return createMiddleware(async (context, next) => {
31
- const idempotencyKeyHeader = context.req.header("X-Idempotency-Key");
31
+ const idempotencyKeyHeader = context.req.header("x-idempotency-key");
32
32
  if (!idempotencyKeyHeader) {
33
33
  throw new HTTPException(401, {
34
- message: `The 'X-Idempotency-Key' header must exist and must have a value.`
34
+ message: `The 'x-idempotency-key' header must exist and must have a value.`
35
35
  });
36
36
  }
37
37
  const existingIdempotencyRecord = await context.env.IDEMPOTENCY_KV.get(idempotencyKeyHeader);
@@ -57,21 +57,21 @@ const idempotency = () => {
57
57
 
58
58
  const jwt = () => {
59
59
  return createMiddleware(async (context, next) => {
60
- const authorizationHeader = context.req.header("Authorization");
60
+ const authorizationHeader = context.req.header("authorization");
61
61
  if (!authorizationHeader) {
62
62
  throw new HTTPException(401, {
63
- message: `The 'Authorization' header must exist and must have a value.`
63
+ message: `The 'authorization' header must exist and must have a value.`
64
64
  });
65
65
  }
66
66
  if (!validateBearerScheme(authorizationHeader)) {
67
67
  throw new HTTPException(401, {
68
- message: `The 'Authorization' header value must use the Bearer scheme.`
68
+ message: `The 'authorization' header value must use the Bearer scheme.`
69
69
  });
70
70
  }
71
71
  const bearerToken = extractBearerToken(authorizationHeader);
72
72
  if (!validateBearerToken(bearerToken)) {
73
73
  throw new HTTPException(401, {
74
- message: `The Bearer token in the 'Authorization' header value must be a JWT.`
74
+ message: `The Bearer token in the 'authorization' header value must be a JWT.`
75
75
  });
76
76
  }
77
77
  const { data, error } = await context.env.AUTH_SERVICE.verifyAccessToken({
@@ -95,7 +95,6 @@ const jwt = () => {
95
95
  role: data.payload.user.role,
96
96
  organizationId
97
97
  });
98
- context.set("jwt", data.payload);
99
98
  await next();
100
99
  });
101
100
  };
@@ -173,16 +172,16 @@ const logger = () => {
173
172
  const signature = () => {
174
173
  return createMiddleware(async (context, next) => {
175
174
  if (!["localhost", "dev"].includes(context.env.ENVIRONMENT)) {
176
- const signatureHeader = context.req.header("X-Signature");
175
+ const signatureHeader = context.req.header("x-signature");
177
176
  if (!signatureHeader) {
178
177
  throw new HTTPException(401, {
179
- message: `The 'X-Signature' header must exist and must have a value.`
178
+ message: `The 'x-signature' header must exist and must have a value.`
180
179
  });
181
180
  }
182
181
  const signatureKeyHeader = context.req.header("X-Signature-Key");
183
182
  if (!signatureKeyHeader) {
184
183
  throw new HTTPException(401, {
185
- message: `The 'X-Signature-Key' header must exist and must have a value.`
184
+ message: `The 'x-signature-key' header must exist and must have a value.`
186
185
  });
187
186
  }
188
187
  const payload = JSON.stringify(await context.req.json().catch(() => null));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-io/backend-sdk",
3
- "version": "9.0.0",
3
+ "version": "9.0.1",
4
4
  "description": "Develit Backend SDK",
5
5
  "author": "Develit.io",
6
6
  "license": "ISC",