@pelatform/starter 0.1.8 → 0.2.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/extend.d.ts +10 -136
- package/dist/extend.js +5 -24
- package/dist/index.d.ts +6 -3980
- package/dist/index.js +7 -7267
- package/dist/server.js +3 -6
- package/dist/style.css +6 -0
- package/package.json +35 -51
- package/dist/chunk-IEJXTIKE.js +0 -241
- package/dist/chunk-K5RU54UL.js +0 -8
- package/dist/workspace-CcGHPtq0.d.ts +0 -3431
package/dist/server.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
lastVisitedWorkspace
|
|
3
|
-
} from "./chunk-K5RU54UL.js";
|
|
4
|
-
|
|
5
|
-
// src/lib/auth-server.ts
|
|
1
|
+
// src/server/auth.ts
|
|
6
2
|
import { cache } from "react";
|
|
7
3
|
import { headers } from "next/headers";
|
|
8
4
|
var getSession = cache(async (auth) => {
|
|
@@ -53,8 +49,9 @@ var setActiveWorkspace = cache(async (auth, slug) => {
|
|
|
53
49
|
}
|
|
54
50
|
});
|
|
55
51
|
|
|
56
|
-
// src/
|
|
52
|
+
// src/server/workspace.ts
|
|
57
53
|
import { cookies } from "next/headers";
|
|
54
|
+
import { lastVisitedWorkspace } from "@pelatform/starter.utils";
|
|
58
55
|
var setServerLastVisitedWorkspace = async (workspace, maxAge = 30 * 86400) => {
|
|
59
56
|
if (!workspace || typeof workspace !== "string" || workspace.trim().length === 0) {
|
|
60
57
|
throw new Error("Invalid workspace: must be a non-empty string");
|
package/dist/style.css
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pelatform/starter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A collection of SaaS starter kit components and utilities for Pelatform applications.",
|
|
5
5
|
"author": "Pelatform",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,39 +9,18 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"sideEffects": false,
|
|
11
11
|
"exports": {
|
|
12
|
-
"./css":
|
|
13
|
-
"development": "./src/style.css",
|
|
14
|
-
"default": "./dist/style.css"
|
|
15
|
-
},
|
|
12
|
+
"./css": "./dist/style.css",
|
|
16
13
|
".": {
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
"default": "./src/index.ts"
|
|
20
|
-
},
|
|
21
|
-
"import": {
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
|
-
"default": "./dist/index.js"
|
|
24
|
-
}
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
25
16
|
},
|
|
26
17
|
"./extend": {
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
"default": "./src/extend.ts"
|
|
30
|
-
},
|
|
31
|
-
"import": {
|
|
32
|
-
"types": "./dist/extend.d.ts",
|
|
33
|
-
"default": "./dist/extend.js"
|
|
34
|
-
}
|
|
18
|
+
"types": "./dist/extend.d.ts",
|
|
19
|
+
"default": "./dist/extend.js"
|
|
35
20
|
},
|
|
36
21
|
"./server": {
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"default": "./src/server.ts"
|
|
40
|
-
},
|
|
41
|
-
"import": {
|
|
42
|
-
"types": "./dist/server.d.ts",
|
|
43
|
-
"default": "./dist/server.js"
|
|
44
|
-
}
|
|
22
|
+
"types": "./dist/server.d.ts",
|
|
23
|
+
"default": "./dist/server.js"
|
|
45
24
|
}
|
|
46
25
|
},
|
|
47
26
|
"scripts": {
|
|
@@ -49,9 +28,7 @@
|
|
|
49
28
|
"clean:all": "rimraf .turbo dist node_modules",
|
|
50
29
|
"dev": "tsup --watch --onSuccess \"cp src/style.css dist/style.css\"",
|
|
51
30
|
"build": "tsup && cp src/style.css dist/style.css",
|
|
52
|
-
"types:check": "tsc --noEmit"
|
|
53
|
-
"prepack": "node scripts/prepare-publish.mjs",
|
|
54
|
-
"postpack": "git checkout -- package.json"
|
|
31
|
+
"types:check": "tsc --noEmit"
|
|
55
32
|
},
|
|
56
33
|
"files": [
|
|
57
34
|
"dist"
|
|
@@ -62,46 +39,53 @@
|
|
|
62
39
|
"components",
|
|
63
40
|
"utilities"
|
|
64
41
|
],
|
|
65
|
-
"dependencies": {
|
|
66
|
-
"@better-fetch/fetch": "^1.1.19",
|
|
67
|
-
"@tanstack/react-query-devtools": "^5.91.1",
|
|
68
|
-
"qrcode": "^1.5.4",
|
|
69
|
-
"slugify": "^1.6.6",
|
|
70
|
-
"ua-parser-js": "^2.0.6"
|
|
71
|
-
},
|
|
72
42
|
"devDependencies": {
|
|
43
|
+
"@better-fetch/fetch": "^1.1.19",
|
|
73
44
|
"@hookform/resolvers": "^5.2.2",
|
|
45
|
+
"@pelatform/starter.account": "0.2.0",
|
|
46
|
+
"@pelatform/starter.apikey": "0.2.0",
|
|
47
|
+
"@pelatform/starter.auth": "0.2.0",
|
|
48
|
+
"@pelatform/starter.config": "0.2.0",
|
|
49
|
+
"@pelatform/starter.hook": "0.2.0",
|
|
50
|
+
"@pelatform/starter.i18n": "0.2.0",
|
|
51
|
+
"@pelatform/starter.shared": "0.2.0",
|
|
52
|
+
"@pelatform/starter.utils": "0.2.0",
|
|
53
|
+
"@pelatform/starter.workspace": "0.2.0",
|
|
74
54
|
"@pelatform/tsconfig": "^0.1.3",
|
|
75
|
-
"@tanstack/query-core": "^5.90.12",
|
|
76
|
-
"@tanstack/react-query": "^5.90.12",
|
|
77
|
-
"@types/node": "^24.10.1",
|
|
78
|
-
"@types/qrcode": "^1.5.6",
|
|
79
55
|
"@types/react": "^19.2.7",
|
|
80
|
-
"better-auth": "^1.4.
|
|
56
|
+
"better-auth": "^1.4.6",
|
|
81
57
|
"lucide-react": "^0.556.0",
|
|
82
|
-
"next": "^16.0.
|
|
58
|
+
"next": "^16.0.8",
|
|
83
59
|
"next-intl": "^4.5.8",
|
|
84
60
|
"pelatform-ui": "^1.1.3",
|
|
85
61
|
"react": "^19.2.1",
|
|
86
62
|
"react-hook-form": "^7.68.0",
|
|
87
|
-
"tailwindcss": "^4.1.17",
|
|
88
63
|
"tsup": "^8.5.1",
|
|
89
|
-
"typescript": "^5.9.3",
|
|
90
64
|
"zod": "^4.1.13"
|
|
91
65
|
},
|
|
92
66
|
"peerDependencies": {
|
|
67
|
+
"@better-fetch/fetch": ">=1.1.0",
|
|
93
68
|
"@hookform/resolvers": ">=5.2.0",
|
|
69
|
+
"@pelatform/starter.account": ">=0.1.0",
|
|
70
|
+
"@pelatform/starter.apikey": ">=0.1.0",
|
|
71
|
+
"@pelatform/starter.auth": ">=0.1.0",
|
|
72
|
+
"@pelatform/starter.config": ">=0.1.0",
|
|
73
|
+
"@pelatform/starter.hook": ">=0.1.0",
|
|
74
|
+
"@pelatform/starter.i18n": ">=0.1.0",
|
|
75
|
+
"@pelatform/starter.shared": ">=0.1.0",
|
|
76
|
+
"@pelatform/starter.utils": ">=0.1.0",
|
|
77
|
+
"@pelatform/starter.workspace": ">=0.1.0",
|
|
94
78
|
"@tanstack/query-core": ">=5.90.0",
|
|
95
79
|
"@tanstack/react-query": ">=5.90.0",
|
|
96
|
-
"better-auth": ">=1.4.
|
|
80
|
+
"better-auth": ">=1.4.5",
|
|
97
81
|
"lucide-react": ">=0.55.0",
|
|
98
82
|
"next": ">=16.0.0",
|
|
99
|
-
"next-intl": ">=4.
|
|
83
|
+
"next-intl": ">=4.5.0",
|
|
100
84
|
"pelatform-ui": ">=1.1.0",
|
|
101
85
|
"react": ">=18.0.0 || >=19.0.0-rc.0",
|
|
102
|
-
"react-hook-form": ">=7.
|
|
86
|
+
"react-hook-form": ">=7.5.0",
|
|
103
87
|
"tailwindcss": ">=3.0.0",
|
|
104
|
-
"zod": ">=4.
|
|
88
|
+
"zod": ">=4.1.0"
|
|
105
89
|
},
|
|
106
90
|
"publishConfig": {
|
|
107
91
|
"registry": "https://registry.npmjs.org/",
|
package/dist/chunk-IEJXTIKE.js
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
lastVisitedWorkspace
|
|
3
|
-
} from "./chunk-K5RU54UL.js";
|
|
4
|
-
|
|
5
|
-
// src/config/query.ts
|
|
6
|
-
var defaultAuthQueryOptions = {
|
|
7
|
-
sessionQueryOptions: {
|
|
8
|
-
staleTime: 60 * 1e3
|
|
9
|
-
},
|
|
10
|
-
optimistic: true,
|
|
11
|
-
refetchOnMutate: true,
|
|
12
|
-
queryKey: {
|
|
13
|
-
accountInfo: ["account-info"],
|
|
14
|
-
invitationKey: ["invitation"],
|
|
15
|
-
listAccounts: ["list-accounts"],
|
|
16
|
-
listApiKeys: ["list-api-keys"],
|
|
17
|
-
listDeviceSessions: ["list-device-sessions"],
|
|
18
|
-
listPasskeys: ["list-passkeys"],
|
|
19
|
-
listSessions: ["list-sessions"],
|
|
20
|
-
session: ["session"],
|
|
21
|
-
// Workspace
|
|
22
|
-
workspaceById: (id) => ["workspace", id],
|
|
23
|
-
workspaceBySlug: (slug) => ["workspace_by_slug", slug],
|
|
24
|
-
workspaceList: ["workspaces"],
|
|
25
|
-
// Workspace-scoped resources
|
|
26
|
-
webhooks: (workspaceId) => ["webhooks", workspaceId],
|
|
27
|
-
billings: (workspaceId) => ["billings", workspaceId],
|
|
28
|
-
billingUsage: (workspaceId) => ["billing-usage", workspaceId]
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// src/lib/password-schema.ts
|
|
33
|
-
import { z } from "zod";
|
|
34
|
-
function getPasswordSchema(t) {
|
|
35
|
-
const getError = (key, fallback) => {
|
|
36
|
-
return t ? t(`systems.${key}`) : fallback;
|
|
37
|
-
};
|
|
38
|
-
const minLength = 8;
|
|
39
|
-
const maxLength = 32;
|
|
40
|
-
const regex = void 0;
|
|
41
|
-
let schema = z.string().min(1, {
|
|
42
|
-
error: getError("PASSWORD_REQUIRED", "Password is required")
|
|
43
|
-
});
|
|
44
|
-
schema = schema.min(minLength, {
|
|
45
|
-
error: getError("PASSWORD_TOO_SHORT", "Password is too short")
|
|
46
|
-
});
|
|
47
|
-
schema = schema.max(maxLength, {
|
|
48
|
-
error: getError("PASSWORD_TOO_LONG", "Password is too long")
|
|
49
|
-
});
|
|
50
|
-
if (regex) {
|
|
51
|
-
schema = schema.regex(regex, {
|
|
52
|
-
error: getError("INVALID_PASSWORD", "Invalid password")
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return schema;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// src/lib/request.ts
|
|
59
|
-
async function request(endpoint, method = "GET", body, log) {
|
|
60
|
-
const isFormData = typeof FormData !== "undefined" && body instanceof FormData;
|
|
61
|
-
const headers = {};
|
|
62
|
-
let payload;
|
|
63
|
-
if (body !== void 0) {
|
|
64
|
-
if (isFormData) {
|
|
65
|
-
payload = body;
|
|
66
|
-
} else {
|
|
67
|
-
headers["Content-Type"] = "application/json";
|
|
68
|
-
payload = JSON.stringify(body);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
const response = await fetch(endpoint, {
|
|
72
|
-
method,
|
|
73
|
-
headers,
|
|
74
|
-
body: payload
|
|
75
|
-
});
|
|
76
|
-
if (!response.ok) {
|
|
77
|
-
throw new Error(response.statusText);
|
|
78
|
-
}
|
|
79
|
-
const data = await response.json();
|
|
80
|
-
if (log) {
|
|
81
|
-
console.log(endpoint, data);
|
|
82
|
-
}
|
|
83
|
-
return data;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// src/lib/social-providers.ts
|
|
87
|
-
import { Icons } from "pelatform-ui";
|
|
88
|
-
var socialProviders = [
|
|
89
|
-
{
|
|
90
|
-
provider: "apple",
|
|
91
|
-
name: "Apple",
|
|
92
|
-
icon: Icons.Apple
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
provider: "discord",
|
|
96
|
-
name: "Discord",
|
|
97
|
-
icon: Icons.Discord
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
provider: "dropbox",
|
|
101
|
-
name: "Dropbox",
|
|
102
|
-
icon: Icons.Dropbox
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
provider: "facebook",
|
|
106
|
-
name: "Facebook",
|
|
107
|
-
icon: Icons.FacebookColorful
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
provider: "github",
|
|
111
|
-
name: "GitHub",
|
|
112
|
-
icon: Icons.Github
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
provider: "gitlab",
|
|
116
|
-
name: "GitLab",
|
|
117
|
-
icon: Icons.Gitlab
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
provider: "google",
|
|
121
|
-
name: "Google",
|
|
122
|
-
icon: Icons.GoogleColorful
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
provider: "huggingface",
|
|
126
|
-
name: "Hugging Face",
|
|
127
|
-
icon: Icons.Huggingface
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
provider: "kick",
|
|
131
|
-
name: "Kick",
|
|
132
|
-
icon: Icons.Kick
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
provider: "linear",
|
|
136
|
-
name: "Linear",
|
|
137
|
-
icon: Icons.Linear
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
provider: "linkedin",
|
|
141
|
-
name: "LinkedIn",
|
|
142
|
-
icon: Icons.LinkedinColorful
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
provider: "microsoft",
|
|
146
|
-
name: "Microsoft",
|
|
147
|
-
icon: Icons.Microsoft
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
provider: "notion",
|
|
151
|
-
name: "Notion",
|
|
152
|
-
icon: Icons.Notion
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
provider: "reddit",
|
|
156
|
-
name: "Reddit",
|
|
157
|
-
icon: Icons.Reddit
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
provider: "roblox",
|
|
161
|
-
name: "Roblox",
|
|
162
|
-
icon: Icons.Roblox
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
provider: "slack",
|
|
166
|
-
name: "Slack",
|
|
167
|
-
icon: Icons.Slack
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
provider: "spotify",
|
|
171
|
-
name: "Spotify",
|
|
172
|
-
icon: Icons.Spotify
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
provider: "tiktok",
|
|
176
|
-
name: "TikTok",
|
|
177
|
-
icon: Icons.Tiktok
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
provider: "twitch",
|
|
181
|
-
name: "Twitch",
|
|
182
|
-
icon: Icons.Twitch
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
provider: "vk",
|
|
186
|
-
name: "VK",
|
|
187
|
-
icon: Icons.Vk
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
provider: "twitter",
|
|
191
|
-
name: "X",
|
|
192
|
-
icon: Icons.X
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
provider: "zoom",
|
|
196
|
-
name: "Zoom",
|
|
197
|
-
icon: Icons.Zoom
|
|
198
|
-
}
|
|
199
|
-
];
|
|
200
|
-
|
|
201
|
-
// src/lib/translations.ts
|
|
202
|
-
function getTranslations({
|
|
203
|
-
error,
|
|
204
|
-
t
|
|
205
|
-
}) {
|
|
206
|
-
if (typeof error === "string") {
|
|
207
|
-
const translated = t(`systems.${error}`);
|
|
208
|
-
if (translated && translated !== `systems.${error}`) {
|
|
209
|
-
return translated;
|
|
210
|
-
}
|
|
211
|
-
return error;
|
|
212
|
-
}
|
|
213
|
-
if (error?.error) {
|
|
214
|
-
if (error.error.code) {
|
|
215
|
-
const errorCode = error.error.code;
|
|
216
|
-
const translated = t(`systems.${errorCode}`);
|
|
217
|
-
if (translated && translated !== `systems.${errorCode}`) {
|
|
218
|
-
return translated;
|
|
219
|
-
}
|
|
220
|
-
return errorCode;
|
|
221
|
-
}
|
|
222
|
-
return error.error.message || error.error.code || error.error.statusText || t("systems.REQUEST_FAILED");
|
|
223
|
-
}
|
|
224
|
-
return error?.message || t("systems.REQUEST_FAILED") || "Request failed";
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// src/lib/workspace/client.ts
|
|
228
|
-
var setLastVisitedWorkspace = (workspace, maxAge = 30 * 86400) => {
|
|
229
|
-
document.cookie = `${lastVisitedWorkspace}=${workspace}; max-age=${maxAge}; path=/`;
|
|
230
|
-
};
|
|
231
|
-
var getLastVisitedWorkspace = (cookies) => cookies.get(lastVisitedWorkspace)?.value;
|
|
232
|
-
|
|
233
|
-
export {
|
|
234
|
-
defaultAuthQueryOptions,
|
|
235
|
-
getPasswordSchema,
|
|
236
|
-
request,
|
|
237
|
-
socialProviders,
|
|
238
|
-
getTranslations,
|
|
239
|
-
setLastVisitedWorkspace,
|
|
240
|
-
getLastVisitedWorkspace
|
|
241
|
-
};
|