@cmssy/next 0.17.1 → 1.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.cjs +46 -22
- package/dist/index.js +46 -22
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -691,32 +691,48 @@ function createCmssyLocaleMiddleware(config) {
|
|
|
691
691
|
};
|
|
692
692
|
}
|
|
693
693
|
var LOGIN_MUTATION = `mutation SiteMemberLogin($input: SiteMemberLoginInput!) {
|
|
694
|
-
|
|
695
|
-
|
|
694
|
+
siteMember {
|
|
695
|
+
login(input: $input) {
|
|
696
|
+
success message accessToken refreshToken accessTokenExpiresIn
|
|
697
|
+
}
|
|
696
698
|
}
|
|
697
699
|
}`;
|
|
698
700
|
var REGISTER_MUTATION = `mutation SiteMemberRegister($input: SiteMemberRegisterInput!) {
|
|
699
|
-
|
|
701
|
+
siteMember {
|
|
702
|
+
register(input: $input) { success message }
|
|
703
|
+
}
|
|
700
704
|
}`;
|
|
701
705
|
var REFRESH_MUTATION = `mutation SiteMemberRefresh($refreshToken: String!) {
|
|
702
|
-
|
|
703
|
-
|
|
706
|
+
siteMember {
|
|
707
|
+
refresh(refreshToken: $refreshToken) {
|
|
708
|
+
success message accessToken refreshToken accessTokenExpiresIn
|
|
709
|
+
}
|
|
704
710
|
}
|
|
705
711
|
}`;
|
|
706
712
|
var LOGOUT_MUTATION = `mutation SiteMemberLogout($refreshToken: String!) {
|
|
707
|
-
|
|
713
|
+
siteMember {
|
|
714
|
+
logout(refreshToken: $refreshToken) { success message }
|
|
715
|
+
}
|
|
708
716
|
}`;
|
|
709
717
|
var LOGOUT_EVERYWHERE_MUTATION = `mutation SiteMemberLogoutEverywhere {
|
|
710
|
-
|
|
718
|
+
siteMember {
|
|
719
|
+
logoutEverywhere { success message }
|
|
720
|
+
}
|
|
711
721
|
}`;
|
|
712
722
|
var FORGOT_MUTATION = `mutation SiteMemberForgotPassword($modelSlug: String!, $identity: String!) {
|
|
713
|
-
|
|
723
|
+
siteMember {
|
|
724
|
+
forgotPassword(modelSlug: $modelSlug, identity: $identity) { success message }
|
|
725
|
+
}
|
|
714
726
|
}`;
|
|
715
727
|
var RESET_MUTATION = `mutation SiteMemberResetPassword($token: String!, $newPassword: String!) {
|
|
716
|
-
|
|
728
|
+
siteMember {
|
|
729
|
+
resetPassword(token: $token, newPassword: $newPassword) { success message }
|
|
730
|
+
}
|
|
717
731
|
}`;
|
|
718
732
|
var VERIFY_MUTATION = `mutation SiteMemberVerifyEmail($token: String!) {
|
|
719
|
-
|
|
733
|
+
siteMember {
|
|
734
|
+
verifyEmail(token: $token) { success message }
|
|
735
|
+
}
|
|
720
736
|
}`;
|
|
721
737
|
var workspaceIdCache = /* @__PURE__ */ new Map();
|
|
722
738
|
function workspaceIdFor(config) {
|
|
@@ -782,7 +798,7 @@ async function backendSignIn(config, modelSlug, identity, password) {
|
|
|
782
798
|
},
|
|
783
799
|
"site member login"
|
|
784
800
|
);
|
|
785
|
-
return data.
|
|
801
|
+
return data.siteMember.login;
|
|
786
802
|
}
|
|
787
803
|
async function backendRegister(config, modelSlug, identity, password, fields) {
|
|
788
804
|
const data = await authRequest(
|
|
@@ -793,7 +809,7 @@ async function backendRegister(config, modelSlug, identity, password, fields) {
|
|
|
793
809
|
},
|
|
794
810
|
"site member register"
|
|
795
811
|
);
|
|
796
|
-
return data.
|
|
812
|
+
return data.siteMember.register;
|
|
797
813
|
}
|
|
798
814
|
async function backendRefresh(config, refreshToken) {
|
|
799
815
|
const data = await authRequest(
|
|
@@ -802,7 +818,7 @@ async function backendRefresh(config, refreshToken) {
|
|
|
802
818
|
{ refreshToken },
|
|
803
819
|
"site member refresh"
|
|
804
820
|
);
|
|
805
|
-
return data.
|
|
821
|
+
return data.siteMember.refresh;
|
|
806
822
|
}
|
|
807
823
|
async function backendSignOut(config, refreshToken) {
|
|
808
824
|
try {
|
|
@@ -836,7 +852,7 @@ async function backendForgotPassword(config, modelSlug, identity) {
|
|
|
836
852
|
{ modelSlug, identity },
|
|
837
853
|
"site member forgot password"
|
|
838
854
|
);
|
|
839
|
-
return data.
|
|
855
|
+
return data.siteMember.forgotPassword;
|
|
840
856
|
}
|
|
841
857
|
async function backendResetPassword(config, token, newPassword) {
|
|
842
858
|
const data = await authRequest(
|
|
@@ -845,7 +861,7 @@ async function backendResetPassword(config, token, newPassword) {
|
|
|
845
861
|
{ token, newPassword },
|
|
846
862
|
"site member reset password"
|
|
847
863
|
);
|
|
848
|
-
return data.
|
|
864
|
+
return data.siteMember.resetPassword;
|
|
849
865
|
}
|
|
850
866
|
async function backendVerifyEmail(config, token) {
|
|
851
867
|
const data = await authRequest(
|
|
@@ -854,7 +870,7 @@ async function backendVerifyEmail(config, token) {
|
|
|
854
870
|
{ token },
|
|
855
871
|
"site member verify email"
|
|
856
872
|
);
|
|
857
|
-
return data.
|
|
873
|
+
return data.siteMember.verifyEmail;
|
|
858
874
|
}
|
|
859
875
|
|
|
860
876
|
// src/create-auth-route.ts
|
|
@@ -1101,8 +1117,12 @@ var CHECKOUT = `mutation Checkout($input: CheckoutInput!) {
|
|
|
1101
1117
|
cart { checkout(input: $input) { id status subtotal total currency customerEmail } }
|
|
1102
1118
|
}`;
|
|
1103
1119
|
var PRODUCT = `query Product($workspaceId: String!, $modelSlug: String!, $filter: JSON) {
|
|
1104
|
-
|
|
1105
|
-
|
|
1120
|
+
public {
|
|
1121
|
+
model {
|
|
1122
|
+
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, limit: 1) {
|
|
1123
|
+
items { id data variants { id sku price inventory selectedOptions { name value } } }
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1106
1126
|
}
|
|
1107
1127
|
}`;
|
|
1108
1128
|
var workspaceIdCache2 = /* @__PURE__ */ new Map();
|
|
@@ -1238,7 +1258,7 @@ async function backendProduct(config, ctx, modelSlug, filter) {
|
|
|
1238
1258
|
{ workspaceId, modelSlug, filter },
|
|
1239
1259
|
"product query"
|
|
1240
1260
|
);
|
|
1241
|
-
return data.
|
|
1261
|
+
return data.public.model.records.items[0] ?? null;
|
|
1242
1262
|
}
|
|
1243
1263
|
|
|
1244
1264
|
// src/create-cart-route.ts
|
|
@@ -1447,8 +1467,12 @@ function createCmssyAuthMiddleware(config) {
|
|
|
1447
1467
|
};
|
|
1448
1468
|
}
|
|
1449
1469
|
var PRODUCTS_QUERY = `query Products($workspaceId: String!, $modelSlug: String!, $filter: JSON, $limit: Int) {
|
|
1450
|
-
|
|
1451
|
-
|
|
1470
|
+
public {
|
|
1471
|
+
model {
|
|
1472
|
+
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, limit: $limit) {
|
|
1473
|
+
items { id data variants { id sku price inventory selectedOptions { name value } } }
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1452
1476
|
}
|
|
1453
1477
|
}`;
|
|
1454
1478
|
async function fetchProducts(config, options) {
|
|
@@ -1465,7 +1489,7 @@ async function fetchProducts(config, options) {
|
|
|
1465
1489
|
{ headers: { "x-workspace-id": workspaceId } },
|
|
1466
1490
|
"products query"
|
|
1467
1491
|
);
|
|
1468
|
-
return data.
|
|
1492
|
+
return data.public.model.records.items;
|
|
1469
1493
|
}
|
|
1470
1494
|
async function fetchProduct(config, options) {
|
|
1471
1495
|
const products = await fetchProducts(config, {
|
package/dist/index.js
CHANGED
|
@@ -690,32 +690,48 @@ function createCmssyLocaleMiddleware(config) {
|
|
|
690
690
|
};
|
|
691
691
|
}
|
|
692
692
|
var LOGIN_MUTATION = `mutation SiteMemberLogin($input: SiteMemberLoginInput!) {
|
|
693
|
-
|
|
694
|
-
|
|
693
|
+
siteMember {
|
|
694
|
+
login(input: $input) {
|
|
695
|
+
success message accessToken refreshToken accessTokenExpiresIn
|
|
696
|
+
}
|
|
695
697
|
}
|
|
696
698
|
}`;
|
|
697
699
|
var REGISTER_MUTATION = `mutation SiteMemberRegister($input: SiteMemberRegisterInput!) {
|
|
698
|
-
|
|
700
|
+
siteMember {
|
|
701
|
+
register(input: $input) { success message }
|
|
702
|
+
}
|
|
699
703
|
}`;
|
|
700
704
|
var REFRESH_MUTATION = `mutation SiteMemberRefresh($refreshToken: String!) {
|
|
701
|
-
|
|
702
|
-
|
|
705
|
+
siteMember {
|
|
706
|
+
refresh(refreshToken: $refreshToken) {
|
|
707
|
+
success message accessToken refreshToken accessTokenExpiresIn
|
|
708
|
+
}
|
|
703
709
|
}
|
|
704
710
|
}`;
|
|
705
711
|
var LOGOUT_MUTATION = `mutation SiteMemberLogout($refreshToken: String!) {
|
|
706
|
-
|
|
712
|
+
siteMember {
|
|
713
|
+
logout(refreshToken: $refreshToken) { success message }
|
|
714
|
+
}
|
|
707
715
|
}`;
|
|
708
716
|
var LOGOUT_EVERYWHERE_MUTATION = `mutation SiteMemberLogoutEverywhere {
|
|
709
|
-
|
|
717
|
+
siteMember {
|
|
718
|
+
logoutEverywhere { success message }
|
|
719
|
+
}
|
|
710
720
|
}`;
|
|
711
721
|
var FORGOT_MUTATION = `mutation SiteMemberForgotPassword($modelSlug: String!, $identity: String!) {
|
|
712
|
-
|
|
722
|
+
siteMember {
|
|
723
|
+
forgotPassword(modelSlug: $modelSlug, identity: $identity) { success message }
|
|
724
|
+
}
|
|
713
725
|
}`;
|
|
714
726
|
var RESET_MUTATION = `mutation SiteMemberResetPassword($token: String!, $newPassword: String!) {
|
|
715
|
-
|
|
727
|
+
siteMember {
|
|
728
|
+
resetPassword(token: $token, newPassword: $newPassword) { success message }
|
|
729
|
+
}
|
|
716
730
|
}`;
|
|
717
731
|
var VERIFY_MUTATION = `mutation SiteMemberVerifyEmail($token: String!) {
|
|
718
|
-
|
|
732
|
+
siteMember {
|
|
733
|
+
verifyEmail(token: $token) { success message }
|
|
734
|
+
}
|
|
719
735
|
}`;
|
|
720
736
|
var workspaceIdCache = /* @__PURE__ */ new Map();
|
|
721
737
|
function workspaceIdFor(config) {
|
|
@@ -781,7 +797,7 @@ async function backendSignIn(config, modelSlug, identity, password) {
|
|
|
781
797
|
},
|
|
782
798
|
"site member login"
|
|
783
799
|
);
|
|
784
|
-
return data.
|
|
800
|
+
return data.siteMember.login;
|
|
785
801
|
}
|
|
786
802
|
async function backendRegister(config, modelSlug, identity, password, fields) {
|
|
787
803
|
const data = await authRequest(
|
|
@@ -792,7 +808,7 @@ async function backendRegister(config, modelSlug, identity, password, fields) {
|
|
|
792
808
|
},
|
|
793
809
|
"site member register"
|
|
794
810
|
);
|
|
795
|
-
return data.
|
|
811
|
+
return data.siteMember.register;
|
|
796
812
|
}
|
|
797
813
|
async function backendRefresh(config, refreshToken) {
|
|
798
814
|
const data = await authRequest(
|
|
@@ -801,7 +817,7 @@ async function backendRefresh(config, refreshToken) {
|
|
|
801
817
|
{ refreshToken },
|
|
802
818
|
"site member refresh"
|
|
803
819
|
);
|
|
804
|
-
return data.
|
|
820
|
+
return data.siteMember.refresh;
|
|
805
821
|
}
|
|
806
822
|
async function backendSignOut(config, refreshToken) {
|
|
807
823
|
try {
|
|
@@ -835,7 +851,7 @@ async function backendForgotPassword(config, modelSlug, identity) {
|
|
|
835
851
|
{ modelSlug, identity },
|
|
836
852
|
"site member forgot password"
|
|
837
853
|
);
|
|
838
|
-
return data.
|
|
854
|
+
return data.siteMember.forgotPassword;
|
|
839
855
|
}
|
|
840
856
|
async function backendResetPassword(config, token, newPassword) {
|
|
841
857
|
const data = await authRequest(
|
|
@@ -844,7 +860,7 @@ async function backendResetPassword(config, token, newPassword) {
|
|
|
844
860
|
{ token, newPassword },
|
|
845
861
|
"site member reset password"
|
|
846
862
|
);
|
|
847
|
-
return data.
|
|
863
|
+
return data.siteMember.resetPassword;
|
|
848
864
|
}
|
|
849
865
|
async function backendVerifyEmail(config, token) {
|
|
850
866
|
const data = await authRequest(
|
|
@@ -853,7 +869,7 @@ async function backendVerifyEmail(config, token) {
|
|
|
853
869
|
{ token },
|
|
854
870
|
"site member verify email"
|
|
855
871
|
);
|
|
856
|
-
return data.
|
|
872
|
+
return data.siteMember.verifyEmail;
|
|
857
873
|
}
|
|
858
874
|
|
|
859
875
|
// src/create-auth-route.ts
|
|
@@ -1100,8 +1116,12 @@ var CHECKOUT = `mutation Checkout($input: CheckoutInput!) {
|
|
|
1100
1116
|
cart { checkout(input: $input) { id status subtotal total currency customerEmail } }
|
|
1101
1117
|
}`;
|
|
1102
1118
|
var PRODUCT = `query Product($workspaceId: String!, $modelSlug: String!, $filter: JSON) {
|
|
1103
|
-
|
|
1104
|
-
|
|
1119
|
+
public {
|
|
1120
|
+
model {
|
|
1121
|
+
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, limit: 1) {
|
|
1122
|
+
items { id data variants { id sku price inventory selectedOptions { name value } } }
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1105
1125
|
}
|
|
1106
1126
|
}`;
|
|
1107
1127
|
var workspaceIdCache2 = /* @__PURE__ */ new Map();
|
|
@@ -1237,7 +1257,7 @@ async function backendProduct(config, ctx, modelSlug, filter) {
|
|
|
1237
1257
|
{ workspaceId, modelSlug, filter },
|
|
1238
1258
|
"product query"
|
|
1239
1259
|
);
|
|
1240
|
-
return data.
|
|
1260
|
+
return data.public.model.records.items[0] ?? null;
|
|
1241
1261
|
}
|
|
1242
1262
|
|
|
1243
1263
|
// src/create-cart-route.ts
|
|
@@ -1446,8 +1466,12 @@ function createCmssyAuthMiddleware(config) {
|
|
|
1446
1466
|
};
|
|
1447
1467
|
}
|
|
1448
1468
|
var PRODUCTS_QUERY = `query Products($workspaceId: String!, $modelSlug: String!, $filter: JSON, $limit: Int) {
|
|
1449
|
-
|
|
1450
|
-
|
|
1469
|
+
public {
|
|
1470
|
+
model {
|
|
1471
|
+
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, limit: $limit) {
|
|
1472
|
+
items { id data variants { id sku price inventory selectedOptions { name value } } }
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1451
1475
|
}
|
|
1452
1476
|
}`;
|
|
1453
1477
|
async function fetchProducts(config, options) {
|
|
@@ -1464,7 +1488,7 @@ async function fetchProducts(config, options) {
|
|
|
1464
1488
|
{ headers: { "x-workspace-id": workspaceId } },
|
|
1465
1489
|
"products query"
|
|
1466
1490
|
);
|
|
1467
|
-
return data.
|
|
1491
|
+
return data.public.model.records.items;
|
|
1468
1492
|
}
|
|
1469
1493
|
async function fetchProduct(config, options) {
|
|
1470
1494
|
const products = await fetchProducts(config, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Next.js App Router bindings for cmssy headless sites (createCmssyPage + draft preview)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@cmssy/react": "^0.
|
|
44
|
+
"@cmssy/react": "^1.0.0",
|
|
45
45
|
"next": ">=15",
|
|
46
46
|
"react": "^18.2.0 || ^19.0.0",
|
|
47
47
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"tsup": "^8.3.0",
|
|
56
56
|
"typescript": "^5.6.0",
|
|
57
57
|
"vitest": "^2.1.0",
|
|
58
|
-
"@cmssy/react": "0.
|
|
58
|
+
"@cmssy/react": "1.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"jose": "^6.2.3"
|