@cogover/sdk 0.1.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/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Cogover
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# `@cogover/sdk`
|
|
2
|
+
|
|
3
|
+
TypeScript SDK dành cho code khách hàng chạy trên Cogover. Package cung cấp JavaScript
|
|
4
|
+
implementation để chạy local và file khai báo `.d.ts` để IDE có autocomplete,
|
|
5
|
+
documentation và type checking.
|
|
6
|
+
|
|
7
|
+
## Cài đặt
|
|
8
|
+
|
|
9
|
+
Sau khi package được publish lên npm registry:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @cogover/sdk
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Sử dụng
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { createGreeting } from "@cogover/sdk";
|
|
19
|
+
|
|
20
|
+
console.log(createGreeting("Cogover")); // Hello Cogover
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Tài liệu chi tiết dành cho developer được duy trì trong
|
|
24
|
+
`cogover-sdk/docs/` của source repository và không được đóng gói vào npm
|
|
25
|
+
package.
|
|
26
|
+
|
|
27
|
+
## Các lệnh phát triển
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install # Cài dependency theo package-lock.json
|
|
31
|
+
npm run build # Build package và sinh runtime-tools/cogover-sdk.mjs
|
|
32
|
+
npm run build:runtime # Sinh lại runtime module từ dist/index.js
|
|
33
|
+
npm run typecheck # Kiểm tra TypeScript mà không sinh output
|
|
34
|
+
npm test # Build rồi chạy test
|
|
35
|
+
npm run check # Chạy typecheck và test
|
|
36
|
+
npm run clean # Xóa dist/
|
|
37
|
+
npm run pack:dry-run # Xem trước các file sẽ có trong npm package
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Publish
|
|
41
|
+
|
|
42
|
+
Cấu hình npm login/registry của Cogover, sau đó chạy:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm publish
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Với public npm registry, scoped package có thể cần:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm publish --access public
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Lifecycle `prepack` tự chạy `npm run check`, do đó package không được đóng gói
|
|
55
|
+
nếu typecheck hoặc test thất bại.
|
|
56
|
+
|
|
57
|
+
## Quan hệ với TypeScript Runtime
|
|
58
|
+
|
|
59
|
+
Package này giúp IDE và môi trường local resolve `@cogover/sdk`. Khi project
|
|
60
|
+
khách hàng được compile trên server, TypeScript Runtime thay import này bằng
|
|
61
|
+
`runtime-tools/cogover-sdk.mjs` và không bundle `node_modules` của khách hàng.
|
|
62
|
+
|
|
63
|
+
`src/index.ts` là source of truth. `npm run build` compile npm package và tự sinh lại
|
|
64
|
+
`../runtime-tools/cogover-sdk.mjs` từ cùng source. Không sửa runtime module bằng
|
|
65
|
+
tay. Test cũng so sánh public behavior của hai module để phát hiện sai lệch.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
`@cogover/sdk` được phát hành theo [MIT License](LICENSE).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,UAAU,cAAc,CAAC,IAAY;IACvC,OAAO,SAAS,IAAI,EAAE,CAAC;AAC3B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cogover/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for customer code running on Cogover",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"clean": "node ./scripts/clean.mjs",
|
|
23
|
+
"build": "npm run clean && tsc -p tsconfig.json && npm run build:runtime",
|
|
24
|
+
"build:runtime": "node ./scripts/build-runtime-module.mjs",
|
|
25
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
26
|
+
"test": "npm run build && node --test",
|
|
27
|
+
"check": "npm run typecheck && npm test",
|
|
28
|
+
"pack:dry-run": "npm pack --dry-run --ignore-scripts",
|
|
29
|
+
"prepack": "npm run check"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"cogover",
|
|
36
|
+
"sdk",
|
|
37
|
+
"typescript"
|
|
38
|
+
],
|
|
39
|
+
"license": "MIT",
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"typescript": "5.9.3"
|
|
42
|
+
}
|
|
43
|
+
}
|