@ciderjs/gasnuki 0.5.0 → 0.5.1
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/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/promise.cjs +18 -1
- package/dist/promise.d.cts +1 -1
- package/dist/promise.d.mts +1 -1
- package/dist/promise.d.ts +1 -1
- package/dist/promise.mjs +18 -1
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @ciderjs/gasnuki
|
|
2
2
|
|
|
3
3
|
[](./README.md)
|
|
4
|
-
[](https://github.com/luthpg/gasnuki)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](https://www.npmjs.com/package/@ciderjs/gasnuki)
|
|
7
7
|

|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @ciderjs/gasnuki
|
|
2
2
|
|
|
3
3
|
[](./README.ja.md)
|
|
4
|
-
[](https://github.com/luthpg/gasnuki)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](https://www.npmjs.com/package/@ciderjs/gasnuki)
|
|
7
7
|

|
package/dist/cli.cjs
CHANGED
package/dist/cli.mjs
CHANGED
package/dist/promise.cjs
CHANGED
|
@@ -7,7 +7,24 @@ function getPromisedServerScripts(options = {}) {
|
|
|
7
7
|
return new Proxy(mockupFunctions, {
|
|
8
8
|
get(target, method) {
|
|
9
9
|
if (!("google" in globalThis) || !google?.script?.run) {
|
|
10
|
-
|
|
10
|
+
const mockFunc = target[method];
|
|
11
|
+
if (!mockFunc) {
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
if (!parseJson) {
|
|
15
|
+
return mockFunc;
|
|
16
|
+
}
|
|
17
|
+
return async (...args) => {
|
|
18
|
+
const res = await mockFunc(...args);
|
|
19
|
+
if (typeof res === "string") {
|
|
20
|
+
try {
|
|
21
|
+
return json.deserialize(res);
|
|
22
|
+
} catch {
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return res;
|
|
27
|
+
};
|
|
11
28
|
}
|
|
12
29
|
if (!(method in google.script.run)) {
|
|
13
30
|
throw Error(`Method ${method} not found in AppsScript.`);
|
package/dist/promise.d.cts
CHANGED
|
@@ -10,7 +10,7 @@ type PromisedWithJson<T> = {
|
|
|
10
10
|
type PartialScriptType<T> = Partial<Promised<T>>;
|
|
11
11
|
type PartialScriptTypeWithJson<T> = Partial<PromisedWithJson<T>>;
|
|
12
12
|
type GetPromisedServerScriptsOptions<T, IsJson extends boolean = boolean> = {
|
|
13
|
-
mockupFunctions?:
|
|
13
|
+
mockupFunctions?: PartialScriptType<T>;
|
|
14
14
|
parseJson?: IsJson;
|
|
15
15
|
};
|
|
16
16
|
declare function getPromisedServerScripts<T extends Record<string, (...args: any[]) => any> = Omit<typeof google.script.run, 'withSuccessHandler' | 'withFailureHandler' | 'withUserObject'>>(options: GetPromisedServerScriptsOptions<T, true>): PromisedWithJson<T>;
|
package/dist/promise.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ type PromisedWithJson<T> = {
|
|
|
10
10
|
type PartialScriptType<T> = Partial<Promised<T>>;
|
|
11
11
|
type PartialScriptTypeWithJson<T> = Partial<PromisedWithJson<T>>;
|
|
12
12
|
type GetPromisedServerScriptsOptions<T, IsJson extends boolean = boolean> = {
|
|
13
|
-
mockupFunctions?:
|
|
13
|
+
mockupFunctions?: PartialScriptType<T>;
|
|
14
14
|
parseJson?: IsJson;
|
|
15
15
|
};
|
|
16
16
|
declare function getPromisedServerScripts<T extends Record<string, (...args: any[]) => any> = Omit<typeof google.script.run, 'withSuccessHandler' | 'withFailureHandler' | 'withUserObject'>>(options: GetPromisedServerScriptsOptions<T, true>): PromisedWithJson<T>;
|
package/dist/promise.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ type PromisedWithJson<T> = {
|
|
|
10
10
|
type PartialScriptType<T> = Partial<Promised<T>>;
|
|
11
11
|
type PartialScriptTypeWithJson<T> = Partial<PromisedWithJson<T>>;
|
|
12
12
|
type GetPromisedServerScriptsOptions<T, IsJson extends boolean = boolean> = {
|
|
13
|
-
mockupFunctions?:
|
|
13
|
+
mockupFunctions?: PartialScriptType<T>;
|
|
14
14
|
parseJson?: IsJson;
|
|
15
15
|
};
|
|
16
16
|
declare function getPromisedServerScripts<T extends Record<string, (...args: any[]) => any> = Omit<typeof google.script.run, 'withSuccessHandler' | 'withFailureHandler' | 'withUserObject'>>(options: GetPromisedServerScriptsOptions<T, true>): PromisedWithJson<T>;
|
package/dist/promise.mjs
CHANGED
|
@@ -5,7 +5,24 @@ function getPromisedServerScripts(options = {}) {
|
|
|
5
5
|
return new Proxy(mockupFunctions, {
|
|
6
6
|
get(target, method) {
|
|
7
7
|
if (!("google" in globalThis) || !google?.script?.run) {
|
|
8
|
-
|
|
8
|
+
const mockFunc = target[method];
|
|
9
|
+
if (!mockFunc) {
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
if (!parseJson) {
|
|
13
|
+
return mockFunc;
|
|
14
|
+
}
|
|
15
|
+
return async (...args) => {
|
|
16
|
+
const res = await mockFunc(...args);
|
|
17
|
+
if (typeof res === "string") {
|
|
18
|
+
try {
|
|
19
|
+
return deserialize(res);
|
|
20
|
+
} catch {
|
|
21
|
+
return res;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return res;
|
|
25
|
+
};
|
|
9
26
|
}
|
|
10
27
|
if (!(method in google.script.run)) {
|
|
11
28
|
throw Error(`Method ${method} not found in AppsScript.`);
|