@shophost/rest-api 2.0.69 → 2.0.71
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/package.json +1 -1
- package/schema.prisma +1 -0
- package/src/core/auth/better-auth.lib.js +1 -1
- package/src/core/auth/password-reset.lib.d.ts +3 -0
- package/src/core/auth/password-reset.lib.js +1 -0
- package/src/core/db/__generated__/client/internal/class.js +19 -18
- package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +1 -0
- package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -1
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.d.ts +1 -0
- package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -1
- package/src/core/db/__generated__/client/models/Reservation.d.ts +42 -1
- package/src/core/notifications/email.service.d.ts +13 -0
- package/src/core/notifications/email.service.js +1 -1
- package/src/features/access/access.route.d.ts +2 -2
- package/src/features/auth/emails/password-reset.email.d.ts +17 -0
- package/src/features/auth/emails/password-reset.email.js +1 -0
- package/src/features/cart/cart.route.d.ts +4 -4
- package/src/features/cart/cart.schema.d.ts +6 -6
- package/src/features/cart/cart.service.d.ts +1 -1
- package/src/features/customer/customer.route.d.ts +5 -4
- package/src/features/customer/customer.schema.d.ts +5 -4
- package/src/features/customer/customer.service.d.ts +2 -1
- package/src/features/manufacturer/manufacturer.route.d.ts +4 -4
- package/src/features/order/order.route.d.ts +28 -28
- package/src/features/order/order.schema.d.ts +6 -6
- package/src/features/order/order.service.d.ts +5 -5
- package/src/features/organization/organization-configuration.schema.d.ts +8 -8
- package/src/features/organization/organization.route.d.ts +22 -22
- package/src/features/organization/organization.schema.d.ts +8 -8
- package/src/features/organization/organization.service.d.ts +8 -8
- package/src/features/product/product-modifier.schema.d.ts +10 -10
- package/src/features/product/product.route.d.ts +58 -58
- package/src/features/product/product.schema.d.ts +20 -20
- package/src/features/product/product.service.d.ts +20 -20
- package/src/features/product-category/product-category.route.d.ts +4 -4
- package/src/features/reservation/emails/reservation-cancellation.email.js +1 -1
- package/src/features/reservation/reservation.handler.js +1 -1
- package/src/features/reservation/reservation.route.d.ts +14 -5
- package/src/features/reservation/reservation.route.js +1 -1
- package/src/features/reservation/reservation.schema.d.ts +7 -2
- package/src/features/reservation/reservation.schema.js +1 -1
- package/src/features/reservation/reservation.service.d.ts +9 -2
- package/src/features/reservation/reservation.service.js +1 -1
- package/src/features/shipping-method/shipping-method.route.d.ts +2 -2
- package/src/schemas/locales.schema.d.ts +2 -2
- package/src/schemas/pagination.schema.d.ts +2 -2
- package/src/schemas/queries.schema.d.ts +2 -2
package/package.json
CHANGED
package/schema.prisma
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{betterAuth as
|
|
1
|
+
import{__awaiter as b}from"tslib";import{betterAuth as v}from"better-auth";import{prismaAdapter as y}from"better-auth/adapters/prisma";import{nextCookies as z}from"better-auth/next-js";import{openAPI as h,organization as R}from"better-auth/plugins";import{createAccessControl as S}from"better-auth/plugins/access";import{logger as m}from"../logging/pino";import{EmailService as A}from"../notifications/email.service";import{IntegrationRegistry as C}from"../../features/integration/integration-registry";import{getCurrentUser as I,isGranted as j}from"./auth.util";import{resolvePasswordResetOrganizationId as k}from"./password-reset.lib";const _={project:["create","read","update","delete"],organization:["create","read","update","delete"]},t=S(_),O=t.newRole({project:["read"]}),q=t.newRole({project:["read"]}),x=t.newRole({project:["create","read","update","delete"]}),F=t.newRole({project:["create","read","update","delete"],organization:["update"]}),P=t.newRole({project:["create","read","update","delete"],organization:["update","delete"]});export const createAuthClient=({prisma:o,baseURL:c,domain:i,trustedOrigins:u,socialProviders:r})=>{const p=new A(new C(o)),l=v({baseURL:c,database:y(o,{provider:"postgresql"}),trustedOrigins:u,user:{additionalFields:{firstname:{type:"string",required:!0},lastname:{type:"string",required:!0}}},advanced:{crossSubDomainCookies:{enabled:!0,domain:i},useSecureCookies:i!=="localhost",defaultCookieAttributes:{path:"/",sameSite:"lax",httpOnly:!0,secure:i!=="localhost"}},emailAndPassword:{enabled:!0,sendResetPassword:(a,g)=>b(void 0,[a,g],void 0,function*({user:e,url:f},w){var d;const n=yield k(o,w,e.id);if(!n){m.warn({email:e.email,userId:e.id},"Skipping password reset email because no organization could be resolved");return}const s=yield o.organization.findFirst({where:{id:n,deletedAt:null},select:{id:!0,name:!0,email:!0,logoFile:{select:{url:!0}}}});if(!s){m.warn({organizationId:n,userId:e.id},"Skipping password reset email because the organization was not found");return}yield p.sendPasswordResetEmail(n,{email:e.email,firstname:typeof e.firstname=="string"&&(d=e.firstname)!==null&&d!==void 0?d:null,name:e.name},s,f)})},socialProviders:Object.assign({},r?.google?{google:{prompt:"select_account",clientId:r.google.clientId,clientSecret:r.google.clientSecret,mapProfileToUser:a=>({firstname:a.given_name,lastname:a.family_name})}}:{}),plugins:[h(),z(),R({ac:t,roles:{member:q,readOnly:O,manager:x,admin:F,owner:P}})]});return{auth:l,getCurrentUser:I(l),isGranted:j(l)}};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PrismaClientType } from "../lib/prisma";
|
|
2
|
+
export declare const PASSWORD_RESET_ORGANIZATION_HEADER = "x-shophost-organization-id";
|
|
3
|
+
export declare const resolvePasswordResetOrganizationId: (prisma: PrismaClientType, request: Pick<Request, "headers"> | null | undefined, userId: string) => Promise<string | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as d}from"tslib";export const PASSWORD_RESET_ORGANIZATION_HEADER="x-shophost-organization-id";const a=i=>{const o=i?.trim();return o||void 0};export const resolvePasswordResetOrganizationId=(i,o,r)=>d(void 0,void 0,void 0,function*(){const t=a(o?.headers.get(PASSWORD_RESET_ORGANIZATION_HEADER));if(t){const e=yield i.organization.findFirst({where:{id:t,deletedAt:null},select:{id:!0}});if(e)return e.id}const n=yield i.member.findFirst({where:{userId:r},orderBy:{createdAt:"asc"},select:{organizationId:!0}});return n?.organizationId});
|