@tai-kun/is-promise-like 0.0.1 → 0.0.2
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/LICENSE +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/is-promise-like.d.ts +17 -0
- package/dist/is-promise-like.d.ts.map +1 -0
- package/dist/is-promise-like.js +11 -0
- package/package.json +35 -7
- package/src/index.ts +2 -0
- package/src/is-promise-like.ts +30 -0
- package/README.md +0 -45
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present, tai-kun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,sBAAsB,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as isThenable } from "./is-promise-like.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 値が `PromiseLike`(`then` メソッドを持つオブジェクト)であるかどうかを判定します。
|
|
3
|
+
*
|
|
4
|
+
* @param value 判定する値です。
|
|
5
|
+
* @returns 値が `PromiseLike` である場合は `true`、そうでない場合は `false` を返します。
|
|
6
|
+
*/
|
|
7
|
+
declare function isPromiseLike(value: unknown): value is PromiseLike<unknown>;
|
|
8
|
+
/**
|
|
9
|
+
* 値が特定の型 `T` を持つ `PromiseLike` であるかどうかを判定します。
|
|
10
|
+
*
|
|
11
|
+
* @template T 解決される値の型です。
|
|
12
|
+
* @param value 判定する値です。
|
|
13
|
+
* @returns 値が `PromiseLike<T>` である場合は `true`、そうでない場合は `false` を返します。
|
|
14
|
+
*/
|
|
15
|
+
declare function isPromiseLike<T>(value: unknown): value is PromiseLike<T>;
|
|
16
|
+
export default isPromiseLike;
|
|
17
|
+
//# sourceMappingURL=is-promise-like.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-promise-like.d.ts","sourceRoot":"","sources":["../src/is-promise-like.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,iBAAS,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,iBAAS,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;AAcnE,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tai-kun/is-promise-like",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"src",
|
|
16
|
+
"package.json",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/tai-kun/@tai-kun/is-promise-like",
|
|
20
|
+
"repository": {
|
|
21
|
+
"url": "https://github.com/tai-kun/is-promise-like"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@tsconfig/node22": "^22.0.5",
|
|
25
|
+
"@tsconfig/strictest": "^2.0.8",
|
|
26
|
+
"@types/node": "^22.19.3",
|
|
27
|
+
"@vitest/browser": "^4.0.16",
|
|
28
|
+
"@vitest/browser-playwright": "^4.0.16",
|
|
29
|
+
"dprint": "^0.51.1",
|
|
30
|
+
"npm-check-updates": "^19.2.0",
|
|
31
|
+
"playwright": "^1.57.0",
|
|
32
|
+
"typescript": "^5.9.3",
|
|
33
|
+
"vitest": "^4.0.16"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc --project ./.config/tsconfig.build.json"
|
|
37
|
+
}
|
|
10
38
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 値が `PromiseLike`(`then` メソッドを持つオブジェクト)であるかどうかを判定します。
|
|
3
|
+
*
|
|
4
|
+
* @param value 判定する値です。
|
|
5
|
+
* @returns 値が `PromiseLike` である場合は `true`、そうでない場合は `false` を返します。
|
|
6
|
+
*/
|
|
7
|
+
function isPromiseLike(value: unknown): value is PromiseLike<unknown>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 値が特定の型 `T` を持つ `PromiseLike` であるかどうかを判定します。
|
|
11
|
+
*
|
|
12
|
+
* @template T 解決される値の型です。
|
|
13
|
+
* @param value 判定する値です。
|
|
14
|
+
* @returns 値が `PromiseLike<T>` である場合は `true`、そうでない場合は `false` を返します。
|
|
15
|
+
*/
|
|
16
|
+
function isPromiseLike<T>(value: unknown): value is PromiseLike<T>;
|
|
17
|
+
|
|
18
|
+
function isPromiseLike(value: unknown): boolean {
|
|
19
|
+
try {
|
|
20
|
+
return (
|
|
21
|
+
value != null
|
|
22
|
+
&& (typeof value === "object" || typeof value === "function")
|
|
23
|
+
&& typeof (value as Record<keyof any, unknown>)["then"] === "function"
|
|
24
|
+
);
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default isPromiseLike;
|
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# @tai-kun/is-promise-like
|
|
2
|
-
|
|
3
|
-
## ⚠️ IMPORTANT NOTICE ⚠️
|
|
4
|
-
|
|
5
|
-
**This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
|
|
6
|
-
|
|
7
|
-
This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
|
|
8
|
-
|
|
9
|
-
## Purpose
|
|
10
|
-
|
|
11
|
-
This package exists to:
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@tai-kun/is-promise-like`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
15
|
-
|
|
16
|
-
## What is OIDC Trusted Publishing?
|
|
17
|
-
|
|
18
|
-
OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
|
|
19
|
-
|
|
20
|
-
## Setup Instructions
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|