Skip to content

Commit 166968c

Browse files
authored
Merge develop progress for publishing (#16)
2 parents e5c8235 + 6928c03 commit 166968c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3686
-185
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.inspatial/
22
deno.lock
3-
serve-config.json
3+
cloud-config.json
4+
pgdata/
5+
debug.log

.zed/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
"TypeScript": {
3434
"language_servers": ["deno"],
3535
"formatter": "language_server"
36+
},
37+
"JavaScript": {
38+
"language_servers": ["deno"],
39+
"formatter": "language_server"
40+
// "prettier": null
3641
}
3742
}
3843
}

.zed/tasks.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
[
22
{
33
"command": "deno",
4-
"args": ["task", "dev"],
5-
"cwd": "$ZED_WORKTREE_ROOT/dev",
6-
"label": "Dev App",
4+
"args": [
5+
"run",
6+
"-A",
7+
"--watch",
8+
"--watch-exclude=.inspatial",
9+
"--unstable-broadcast-channel",
10+
"mainApp.ts"
11+
],
12+
"cwd": "$ZED_WORKTREE_ROOT/examples/basic",
13+
"label": "Example: Basic",
714
"allow_concurrent_runs": false,
815
"reveal": "always",
916
"use_new_terminal": false,
10-
"tags": ["App"],
1117
"reveal_target": "dock"
1218
}
1319
]

deno.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{
22
"name": "@inspatial/cloud",
3-
"version": "0.1.7",
3+
"version": "0.2.0",
44
"license": "Apache-2.0",
55
"exports": {
66
".": "./mod.ts",
77
"./extensions": "./extensions/mod.ts",
88
"./types": "./types.ts"
99
},
10+
"publish": {
11+
"include": [
12+
"src/",
13+
"examples/",
14+
"extensions/",
15+
"types.ts",
16+
"mod.ts",
17+
"README.md",
18+
"LICENSE"
19+
],
20+
"exclude": [".github/", ".vscode/", ".zed/", "examples/**/.inspatial/"]
21+
},
22+
1023
"imports": {
1124
"#/": "./src/",
1225
"#extensions/": "./extensions/",
@@ -18,8 +31,8 @@
1831
},
1932
"lint": {
2033
"rules": {
21-
"tags": ["jsr", "recommended"],
22-
"include": ["explicit-module-boundary-types", "verbatim-module-syntax"],
34+
"tags": [],
35+
"include": ["verbatim-module-syntax"],
2336
"exclude": ["no-explicit-any"]
2437
}
2538
}

examples/basic/main.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/basic/mainApp.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { CloudExtension, InCloud } from "@inspatial/cloud";
2+
import { EntryType } from "#/orm/mod.ts";
3+
4+
const app = new InCloud("myApp", {
5+
extensions: [
6+
new CloudExtension("myApp", {
7+
label: "My App",
8+
description: "My awesome app",
9+
entryTypes: [
10+
new EntryType("something", {
11+
fields: [{
12+
key: "thing",
13+
label: "Thingd",
14+
type: "DataField",
15+
}, {
16+
key: "more",
17+
label: "More",
18+
type: "DataField",
19+
}],
20+
}),
21+
],
22+
}),
23+
],
24+
});
25+
26+
if (import.meta.main) {
27+
app.run();
28+
// const result = Deno.readDirSync("/");
29+
// for (const item of result) {
30+
// console.log(item.name, item.isFile, item.isDirectory, item.isSymlink);
31+
// }
32+
}
Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import type { InCloud } from "#/inspatial-cloud.ts";
2-
import ColorMe from "#/utils/color-me.ts";
3-
import { inLog } from "#/in-log/in-log.ts";
42

53
async function checkForUser(app: InCloud) {
64
const { orm } = app;
@@ -25,61 +23,21 @@ async function checkForUser(app: InCloud) {
2523
await user.save();
2624
await user.runAction("setPassword", { password });
2725
app.inLog.info("Admin user created successfully.");
28-
prompt("Press any key to continue...");
26+
// prompt("Press any key to continue...");
2927
}
3028
}
3129

3230
function promptForUser() {
33-
const subject = "Create User";
34-
let firstName: string | null = "";
35-
let lastName: string | null = "";
36-
let email: string | null = "";
37-
let password: string | null = "";
38-
while (!firstName) {
39-
firstName = prompt(ColorMe.fromOptions("First Name:", {
40-
color: "brightCyan",
41-
}));
42-
if (!firstName) {
43-
inLog.warn("First name cannot be empty", subject);
44-
}
45-
}
46-
while (!lastName) {
47-
lastName = prompt(ColorMe.fromOptions("Last Name:", {
48-
color: "brightCyan",
49-
}));
50-
if (!lastName) {
51-
inLog.warn("Last name cannot be empty", subject);
52-
}
53-
}
54-
while (!email) {
55-
email = prompt(ColorMe.fromOptions("Email:", { color: "brightCyan" }));
56-
if (!email) {
57-
inLog.warn("Email cannot be empty", subject);
58-
}
59-
}
60-
while (!password) {
61-
password = prompt("Password:");
62-
if (!password) {
63-
inLog.warn("Password cannot be empty", subject);
64-
}
65-
}
66-
const user = {
31+
let firstName: string | null = "InSpatial";
32+
let lastName: string | null = "Admin";
33+
let email: string | null = "[email protected]";
34+
let password: string | null = "password";
35+
return {
6736
firstName,
6837
lastName,
6938
email,
7039
password,
7140
};
72-
73-
inLog.info(
74-
`User: ${ColorMe.fromOptions(user.firstName, { color: "green" })} ${
75-
ColorMe.fromOptions(
76-
user.lastName,
77-
{ color: "green" },
78-
)
79-
} ${ColorMe.fromOptions(user.email, { color: "green" })}`,
80-
subject,
81-
);
82-
return user;
8341
}
8442

8543
export default checkForUser;

extensions/auth/entry-types/generated-types/user-session.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { EntryBase } from "#/orm/entry/entry-base.ts";
2-
32
export interface UserSession extends EntryBase {
43
_name: "userSession";
54
/**
@@ -11,7 +10,6 @@ export interface UserSession extends EntryBase {
1110
* @required true
1211
*/
1312
user: string;
14-
_userTitle?: string;
1513
/**
1614
* **Session ID** (DataField)
1715
* @description Unique identifier for the session
@@ -45,4 +43,10 @@ export interface UserSession extends EntryBase {
4543
* @required true
4644
*/
4745
updatedAt: number;
46+
/**
47+
* **User Title** (DataField)
48+
* @description The user's full name (automatically generated)
49+
* @type {string}
50+
*/
51+
user__title?: string;
4852
}

extensions/auth/entry-types/generated-types/user.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@ export interface User extends EntryBase {
2525
email: string;
2626
/**
2727
* **Full Name** (DataField)
28-
* @description The user's password used for login
28+
* @description The user's full name (automatically generated)
2929
* @type {string}
3030
*/
3131
fullName?: string;
32+
/**
33+
* **Profile Picture** (ImageField)
34+
* @description The user's profile picture
35+
* @type {string}
36+
*/
37+
profilePicture?: string;
3238
/**
3339
* **Password** (PasswordField)
3440
* @description The user's password used for login
@@ -108,4 +114,9 @@ export interface User extends EntryBase {
108114
* @required true
109115
*/
110116
updatedAt: number;
117+
/**
118+
* **Profile Picture Title** (DataField)
119+
* @type {string}
120+
*/
121+
profilePicture__title?: string;
111122
}

extensions/auth/entry-types/user-session/user-session-entry.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const userSessionEntry = new EntryType<UserSession>("userSession", {
99
idMode: "ulid",
1010
fields: fields,
1111
actions: [],
12+
defaultListFields: ["user"],
1213
hooks: {
1314
beforeCreate: [{
1415
name: "setSessionId",

0 commit comments

Comments
 (0)