@apps-in-toss/framework 0.0.6 → 0.0.8
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/plugins/index.cjs +29 -5
- package/dist/plugins/index.d.cts +18 -2
- package/dist/plugins/index.d.ts +18 -2
- package/dist/plugins/index.js +29 -5
- package/package.json +4 -3
- package/src/bridges.ts +2 -0
package/dist/plugins/index.cjs
CHANGED
|
@@ -32803,9 +32803,25 @@ async function createArtifact({
|
|
|
32803
32803
|
return outfile;
|
|
32804
32804
|
}
|
|
32805
32805
|
|
|
32806
|
+
// src/plugins/utils/createServerOAuthMiddleware.ts
|
|
32807
|
+
init_cjs_shims();
|
|
32808
|
+
function createServerOAuthMiddleware(oauth) {
|
|
32809
|
+
const scope = oauth.scopes.sort().join(";");
|
|
32810
|
+
return (req, res, next) => {
|
|
32811
|
+
if (req.method === "GET" && req.url === "/oauth/scope") {
|
|
32812
|
+
res.writeHead(200, {
|
|
32813
|
+
"Content-Length": Buffer.byteLength(scope),
|
|
32814
|
+
"Content-Type": "text/plain"
|
|
32815
|
+
}).end(scope);
|
|
32816
|
+
return;
|
|
32817
|
+
}
|
|
32818
|
+
next();
|
|
32819
|
+
};
|
|
32820
|
+
}
|
|
32821
|
+
|
|
32806
32822
|
// src/plugins/utils/createServerPermissionsMiddleware.ts
|
|
32807
32823
|
init_cjs_shims();
|
|
32808
|
-
|
|
32824
|
+
function createServerPermissionsMiddleware(permissions) {
|
|
32809
32825
|
const parsedPermissions = parsePermissions(permissions);
|
|
32810
32826
|
return (req, res, next) => {
|
|
32811
32827
|
if (req.method === "GET" && req.url === "/permissions") {
|
|
@@ -33014,14 +33030,17 @@ function appsInTossEsbuildConfig(deploymentId) {
|
|
|
33014
33030
|
}
|
|
33015
33031
|
};
|
|
33016
33032
|
}
|
|
33017
|
-
|
|
33033
|
+
function appsInTossDevServer(options) {
|
|
33018
33034
|
return {
|
|
33019
33035
|
name: "apps-in-toss:dev-server",
|
|
33020
33036
|
config: {
|
|
33021
33037
|
mpack: {
|
|
33022
33038
|
devServer: {
|
|
33023
33039
|
enableRouterGen: false,
|
|
33024
|
-
middlewares: [
|
|
33040
|
+
middlewares: [
|
|
33041
|
+
createServerPermissionsMiddleware(options.permissions),
|
|
33042
|
+
createServerOAuthMiddleware(options.oauth)
|
|
33043
|
+
]
|
|
33025
33044
|
}
|
|
33026
33045
|
}
|
|
33027
33046
|
}
|
|
@@ -33033,13 +33052,18 @@ async function appsInTossAppJson(options) {
|
|
|
33033
33052
|
const appJsonPath = import_path4.default.join(packageRoot, ".bedrock", APP_MANIFEST_NAME);
|
|
33034
33053
|
const appJsonObject = {
|
|
33035
33054
|
appName,
|
|
33036
|
-
permissions: options.permissions
|
|
33055
|
+
permissions: options.permissions,
|
|
33056
|
+
oauth: options.oauth
|
|
33037
33057
|
};
|
|
33038
33058
|
await import_fs3.default.promises.mkdir(import_path4.default.dirname(appJsonPath), { recursive: true });
|
|
33039
33059
|
try {
|
|
33040
33060
|
const existingAppJson = await import_fs3.default.promises.readFile(appJsonPath, "utf8");
|
|
33041
33061
|
const existingAppJsonObject = JSON.parse(existingAppJson);
|
|
33042
|
-
Object.assign(appJsonObject, existingAppJsonObject, {
|
|
33062
|
+
Object.assign(appJsonObject, existingAppJsonObject, {
|
|
33063
|
+
appName,
|
|
33064
|
+
permissions: appJsonObject.permissions,
|
|
33065
|
+
oauth: appJsonObject.oauth
|
|
33066
|
+
});
|
|
33043
33067
|
} catch (error) {
|
|
33044
33068
|
}
|
|
33045
33069
|
await import_fs3.default.promises.writeFile(appJsonPath, JSON.stringify(appJsonObject, null, 2), "utf8");
|
package/dist/plugins/index.d.cts
CHANGED
|
@@ -23,14 +23,30 @@ type CameraPermission = {
|
|
|
23
23
|
access: PermissionAccess;
|
|
24
24
|
};
|
|
25
25
|
type Permission = ClipboardPermission | GeolocationPermission | ContactsPermission | PhotosPermission | CameraPermission;
|
|
26
|
+
/**
|
|
27
|
+
* OAuth 인증시 사용할 수 있는 Scope 값이에요.
|
|
28
|
+
*
|
|
29
|
+
* - `user_name`: 유저 이름이에요.
|
|
30
|
+
* - `user_phone`: 유저 휴대폰 번호예요.
|
|
31
|
+
* - `user_birthday`: 유저 생년월일이에요.
|
|
32
|
+
* - `user_ci`: 유저를 식별하는 키인 CI(Connection Information) 값이에요.
|
|
33
|
+
* - `user_gender`: 유저의 성별이에요.
|
|
34
|
+
* - `user_nationality`: 유저의 국적이에요.
|
|
35
|
+
* - `user_email`: 유저의 이메일이에요. 토스 회원의 email이 존재하지 않는 경우 null 응답을 반환해요.
|
|
36
|
+
*/
|
|
37
|
+
type OAuthScope = 'user_name' | 'user_phone' | 'user_birthday' | 'user_ci' | 'user_gender' | 'user_nationality' | 'user_email';
|
|
26
38
|
type AppManifest = {
|
|
27
39
|
appName: string;
|
|
28
40
|
permissions: Permission[];
|
|
41
|
+
oauth: {
|
|
42
|
+
scopes: OAuthScope[];
|
|
43
|
+
};
|
|
29
44
|
};
|
|
30
45
|
|
|
31
46
|
interface AppsInTossPluginOptions {
|
|
32
|
-
permissions:
|
|
47
|
+
permissions: AppManifest['permissions'];
|
|
48
|
+
oauth: AppManifest['oauth'];
|
|
33
49
|
}
|
|
34
50
|
declare function appsInToss(options: AppsInTossPluginOptions): (BedrockPluginCore | Promise<BedrockPluginCore>)[];
|
|
35
51
|
|
|
36
|
-
export { type AppManifest, type AppsInTossPluginOptions, type Permission, appsInToss };
|
|
52
|
+
export { type AppManifest, type AppsInTossPluginOptions, type OAuthScope, type Permission, appsInToss };
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -23,14 +23,30 @@ type CameraPermission = {
|
|
|
23
23
|
access: PermissionAccess;
|
|
24
24
|
};
|
|
25
25
|
type Permission = ClipboardPermission | GeolocationPermission | ContactsPermission | PhotosPermission | CameraPermission;
|
|
26
|
+
/**
|
|
27
|
+
* OAuth 인증시 사용할 수 있는 Scope 값이에요.
|
|
28
|
+
*
|
|
29
|
+
* - `user_name`: 유저 이름이에요.
|
|
30
|
+
* - `user_phone`: 유저 휴대폰 번호예요.
|
|
31
|
+
* - `user_birthday`: 유저 생년월일이에요.
|
|
32
|
+
* - `user_ci`: 유저를 식별하는 키인 CI(Connection Information) 값이에요.
|
|
33
|
+
* - `user_gender`: 유저의 성별이에요.
|
|
34
|
+
* - `user_nationality`: 유저의 국적이에요.
|
|
35
|
+
* - `user_email`: 유저의 이메일이에요. 토스 회원의 email이 존재하지 않는 경우 null 응답을 반환해요.
|
|
36
|
+
*/
|
|
37
|
+
type OAuthScope = 'user_name' | 'user_phone' | 'user_birthday' | 'user_ci' | 'user_gender' | 'user_nationality' | 'user_email';
|
|
26
38
|
type AppManifest = {
|
|
27
39
|
appName: string;
|
|
28
40
|
permissions: Permission[];
|
|
41
|
+
oauth: {
|
|
42
|
+
scopes: OAuthScope[];
|
|
43
|
+
};
|
|
29
44
|
};
|
|
30
45
|
|
|
31
46
|
interface AppsInTossPluginOptions {
|
|
32
|
-
permissions:
|
|
47
|
+
permissions: AppManifest['permissions'];
|
|
48
|
+
oauth: AppManifest['oauth'];
|
|
33
49
|
}
|
|
34
50
|
declare function appsInToss(options: AppsInTossPluginOptions): (BedrockPluginCore | Promise<BedrockPluginCore>)[];
|
|
35
51
|
|
|
36
|
-
export { type AppManifest, type AppsInTossPluginOptions, type Permission, appsInToss };
|
|
52
|
+
export { type AppManifest, type AppsInTossPluginOptions, type OAuthScope, type Permission, appsInToss };
|
package/dist/plugins/index.js
CHANGED
|
@@ -32809,9 +32809,25 @@ async function createArtifact({
|
|
|
32809
32809
|
return outfile;
|
|
32810
32810
|
}
|
|
32811
32811
|
|
|
32812
|
+
// src/plugins/utils/createServerOAuthMiddleware.ts
|
|
32813
|
+
init_esm_shims();
|
|
32814
|
+
function createServerOAuthMiddleware(oauth) {
|
|
32815
|
+
const scope = oauth.scopes.sort().join(";");
|
|
32816
|
+
return (req, res, next) => {
|
|
32817
|
+
if (req.method === "GET" && req.url === "/oauth/scope") {
|
|
32818
|
+
res.writeHead(200, {
|
|
32819
|
+
"Content-Length": Buffer.byteLength(scope),
|
|
32820
|
+
"Content-Type": "text/plain"
|
|
32821
|
+
}).end(scope);
|
|
32822
|
+
return;
|
|
32823
|
+
}
|
|
32824
|
+
next();
|
|
32825
|
+
};
|
|
32826
|
+
}
|
|
32827
|
+
|
|
32812
32828
|
// src/plugins/utils/createServerPermissionsMiddleware.ts
|
|
32813
32829
|
init_esm_shims();
|
|
32814
|
-
|
|
32830
|
+
function createServerPermissionsMiddleware(permissions) {
|
|
32815
32831
|
const parsedPermissions = parsePermissions(permissions);
|
|
32816
32832
|
return (req, res, next) => {
|
|
32817
32833
|
if (req.method === "GET" && req.url === "/permissions") {
|
|
@@ -33020,14 +33036,17 @@ function appsInTossEsbuildConfig(deploymentId) {
|
|
|
33020
33036
|
}
|
|
33021
33037
|
};
|
|
33022
33038
|
}
|
|
33023
|
-
|
|
33039
|
+
function appsInTossDevServer(options) {
|
|
33024
33040
|
return {
|
|
33025
33041
|
name: "apps-in-toss:dev-server",
|
|
33026
33042
|
config: {
|
|
33027
33043
|
mpack: {
|
|
33028
33044
|
devServer: {
|
|
33029
33045
|
enableRouterGen: false,
|
|
33030
|
-
middlewares: [
|
|
33046
|
+
middlewares: [
|
|
33047
|
+
createServerPermissionsMiddleware(options.permissions),
|
|
33048
|
+
createServerOAuthMiddleware(options.oauth)
|
|
33049
|
+
]
|
|
33031
33050
|
}
|
|
33032
33051
|
}
|
|
33033
33052
|
}
|
|
@@ -33039,13 +33058,18 @@ async function appsInTossAppJson(options) {
|
|
|
33039
33058
|
const appJsonPath = path13.join(packageRoot, ".bedrock", APP_MANIFEST_NAME);
|
|
33040
33059
|
const appJsonObject = {
|
|
33041
33060
|
appName,
|
|
33042
|
-
permissions: options.permissions
|
|
33061
|
+
permissions: options.permissions,
|
|
33062
|
+
oauth: options.oauth
|
|
33043
33063
|
};
|
|
33044
33064
|
await fs8.promises.mkdir(path13.dirname(appJsonPath), { recursive: true });
|
|
33045
33065
|
try {
|
|
33046
33066
|
const existingAppJson = await fs8.promises.readFile(appJsonPath, "utf8");
|
|
33047
33067
|
const existingAppJsonObject = JSON.parse(existingAppJson);
|
|
33048
|
-
Object.assign(appJsonObject, existingAppJsonObject, {
|
|
33068
|
+
Object.assign(appJsonObject, existingAppJsonObject, {
|
|
33069
|
+
appName,
|
|
33070
|
+
permissions: appJsonObject.permissions,
|
|
33071
|
+
oauth: appJsonObject.oauth
|
|
33072
|
+
});
|
|
33049
33073
|
} catch (error) {
|
|
33050
33074
|
}
|
|
33051
33075
|
await fs8.promises.writeFile(appJsonPath, JSON.stringify(appJsonObject, null, 2), "utf8");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apps-in-toss/framework",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"description": "Hub package for Apps In Toss",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prepack": "yarn build",
|
|
@@ -31,13 +31,14 @@
|
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist/**/*",
|
|
34
|
+
"src/bridges.ts",
|
|
34
35
|
"plugins.d.ts"
|
|
35
36
|
],
|
|
36
37
|
"bin": {
|
|
37
38
|
"ait": "./bin.js"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
40
|
-
"@apps-in-toss/cli": "^0.0.
|
|
41
|
+
"@apps-in-toss/cli": "^0.0.8"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@react-native-bedrock/mpack-next": "0.0.11",
|
|
@@ -67,5 +68,5 @@
|
|
|
67
68
|
"publishConfig": {
|
|
68
69
|
"access": "public"
|
|
69
70
|
},
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "44aaa32dffa95a1fe6eb878337caea7b58736ef0"
|
|
71
72
|
}
|
package/src/bridges.ts
ADDED