@tonightpass/react 0.0.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/.turbo/turbo-build.log +21 -0
- package/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/dist/index.d.mts +71 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +32 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAPI.ts +24 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +17 -0
- package/tsup.config.ts +15 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
> @tonightpass/react@0.0.1 build /home/runner/work/tonightpass/tonightpass/packages/react
|
|
3
|
+
> tsup
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.0.2
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/tonightpass/tonightpass/packages/react/tsup.config.ts
|
|
9
|
+
[34mCLI[39m Target: esnext
|
|
10
|
+
[34mCJS[39m Build start
|
|
11
|
+
[34mESM[39m Build start
|
|
12
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m258.00 B[39m
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m940.00 B[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 48ms
|
|
15
|
+
[32mCJS[39m [1mdist/index.js [22m[32m438.00 B[39m
|
|
16
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m940.00 B[39m
|
|
17
|
+
[32mCJS[39m ⚡️ Build success in 48ms
|
|
18
|
+
[34mDTS[39m Build start
|
|
19
|
+
[32mDTS[39m ⚡️ Build success in 1304ms
|
|
20
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.70 KB[39m
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m2.70 KB[39m
|
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Tonight Pass <developers@tonightpass.com>
|
|
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/dist/index.d.mts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as swr from 'swr';
|
|
2
|
+
import * as tonightpass from 'tonightpass';
|
|
3
|
+
import { Client, Query, APIRequestOptions } from 'tonightpass';
|
|
4
|
+
|
|
5
|
+
declare const client: Client;
|
|
6
|
+
declare const useAPI: <Path extends "/careers/categories" | "/careers/employmentTypes" | "/careers/jobs" | "/careers/jobs/:id" | "/careers/offices" | "/health/database" | "/health/http" | "/profiles/:username" | "/users" | "/users/:id" | "/users/me" | "/check/:identifier">(path: Path, query?: Query<Path>, options?: APIRequestOptions) => swr.SWRResponse<(Extract<tonightpass.Endpoint<"GET", "/careers/categories", tonightpass.CareersCategory[], {
|
|
7
|
+
language?: string | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
path: Path;
|
|
10
|
+
method: "GET";
|
|
11
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/careers/employmentTypes", tonightpass.CareersEmploymentType[], {
|
|
12
|
+
language?: string | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
path: Path;
|
|
15
|
+
method: "GET";
|
|
16
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/careers/jobs", tonightpass.CareersJob[], {
|
|
17
|
+
page?: number | undefined;
|
|
18
|
+
pageSize?: number | undefined;
|
|
19
|
+
createdAtGte: string;
|
|
20
|
+
createdAtLt?: string | undefined;
|
|
21
|
+
updatedAtGte?: string | undefined;
|
|
22
|
+
updatedAtLt?: string | undefined;
|
|
23
|
+
status?: "ALL" | "ONLINE" | "ARCHIVED" | undefined;
|
|
24
|
+
content?: boolean | undefined;
|
|
25
|
+
titleLike?: string | undefined;
|
|
26
|
+
countryCode?: string | undefined;
|
|
27
|
+
externalId?: string | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
path: Path;
|
|
30
|
+
method: "GET";
|
|
31
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/careers/jobs/:id", tonightpass.CareersJob, {
|
|
32
|
+
id: number;
|
|
33
|
+
}>, {
|
|
34
|
+
path: Path;
|
|
35
|
+
method: "GET";
|
|
36
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/careers/offices", tonightpass.CareersOffice[], {
|
|
37
|
+
page?: number | undefined;
|
|
38
|
+
pageSize?: number | undefined;
|
|
39
|
+
countryCode?: string | undefined;
|
|
40
|
+
cityNameLike?: string | undefined;
|
|
41
|
+
}>, {
|
|
42
|
+
path: Path;
|
|
43
|
+
method: "GET";
|
|
44
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/health/database", tonightpass.Health<"database">, undefined>, {
|
|
45
|
+
path: Path;
|
|
46
|
+
method: "GET";
|
|
47
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/health/http", tonightpass.Health<"app">, undefined>, {
|
|
48
|
+
path: Path;
|
|
49
|
+
method: "GET";
|
|
50
|
+
}> | Extract<tonightpass.ProfileEndpoints, {
|
|
51
|
+
path: Path;
|
|
52
|
+
method: "GET";
|
|
53
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/users", tonightpass.User[], undefined>, {
|
|
54
|
+
path: Path;
|
|
55
|
+
method: "GET";
|
|
56
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/users/:id", tonightpass.User, {
|
|
57
|
+
id: string;
|
|
58
|
+
}>, {
|
|
59
|
+
path: Path;
|
|
60
|
+
method: "GET";
|
|
61
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/users/me", tonightpass.User, undefined>, {
|
|
62
|
+
path: Path;
|
|
63
|
+
method: "GET";
|
|
64
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/check/:identifier", tonightpass.UserIdentifier, {
|
|
65
|
+
identifier: string;
|
|
66
|
+
}>, {
|
|
67
|
+
path: Path;
|
|
68
|
+
method: "GET";
|
|
69
|
+
}>)["res"], any, any>;
|
|
70
|
+
|
|
71
|
+
export { client, useAPI };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as swr from 'swr';
|
|
2
|
+
import * as tonightpass from 'tonightpass';
|
|
3
|
+
import { Client, Query, APIRequestOptions } from 'tonightpass';
|
|
4
|
+
|
|
5
|
+
declare const client: Client;
|
|
6
|
+
declare const useAPI: <Path extends "/careers/categories" | "/careers/employmentTypes" | "/careers/jobs" | "/careers/jobs/:id" | "/careers/offices" | "/health/database" | "/health/http" | "/profiles/:username" | "/users" | "/users/:id" | "/users/me" | "/check/:identifier">(path: Path, query?: Query<Path>, options?: APIRequestOptions) => swr.SWRResponse<(Extract<tonightpass.Endpoint<"GET", "/careers/categories", tonightpass.CareersCategory[], {
|
|
7
|
+
language?: string | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
path: Path;
|
|
10
|
+
method: "GET";
|
|
11
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/careers/employmentTypes", tonightpass.CareersEmploymentType[], {
|
|
12
|
+
language?: string | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
path: Path;
|
|
15
|
+
method: "GET";
|
|
16
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/careers/jobs", tonightpass.CareersJob[], {
|
|
17
|
+
page?: number | undefined;
|
|
18
|
+
pageSize?: number | undefined;
|
|
19
|
+
createdAtGte: string;
|
|
20
|
+
createdAtLt?: string | undefined;
|
|
21
|
+
updatedAtGte?: string | undefined;
|
|
22
|
+
updatedAtLt?: string | undefined;
|
|
23
|
+
status?: "ALL" | "ONLINE" | "ARCHIVED" | undefined;
|
|
24
|
+
content?: boolean | undefined;
|
|
25
|
+
titleLike?: string | undefined;
|
|
26
|
+
countryCode?: string | undefined;
|
|
27
|
+
externalId?: string | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
path: Path;
|
|
30
|
+
method: "GET";
|
|
31
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/careers/jobs/:id", tonightpass.CareersJob, {
|
|
32
|
+
id: number;
|
|
33
|
+
}>, {
|
|
34
|
+
path: Path;
|
|
35
|
+
method: "GET";
|
|
36
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/careers/offices", tonightpass.CareersOffice[], {
|
|
37
|
+
page?: number | undefined;
|
|
38
|
+
pageSize?: number | undefined;
|
|
39
|
+
countryCode?: string | undefined;
|
|
40
|
+
cityNameLike?: string | undefined;
|
|
41
|
+
}>, {
|
|
42
|
+
path: Path;
|
|
43
|
+
method: "GET";
|
|
44
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/health/database", tonightpass.Health<"database">, undefined>, {
|
|
45
|
+
path: Path;
|
|
46
|
+
method: "GET";
|
|
47
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/health/http", tonightpass.Health<"app">, undefined>, {
|
|
48
|
+
path: Path;
|
|
49
|
+
method: "GET";
|
|
50
|
+
}> | Extract<tonightpass.ProfileEndpoints, {
|
|
51
|
+
path: Path;
|
|
52
|
+
method: "GET";
|
|
53
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/users", tonightpass.User[], undefined>, {
|
|
54
|
+
path: Path;
|
|
55
|
+
method: "GET";
|
|
56
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/users/:id", tonightpass.User, {
|
|
57
|
+
id: string;
|
|
58
|
+
}>, {
|
|
59
|
+
path: Path;
|
|
60
|
+
method: "GET";
|
|
61
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/users/me", tonightpass.User, undefined>, {
|
|
62
|
+
path: Path;
|
|
63
|
+
method: "GET";
|
|
64
|
+
}> | Extract<tonightpass.Endpoint<"GET", "/check/:identifier", tonightpass.UserIdentifier, {
|
|
65
|
+
identifier: string;
|
|
66
|
+
}>, {
|
|
67
|
+
path: Path;
|
|
68
|
+
method: "GET";
|
|
69
|
+
}>)["res"], any, any>;
|
|
70
|
+
|
|
71
|
+
export { client, useAPI };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var s = require('swr');
|
|
4
|
+
var tonightpass = require('tonightpass');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var s__default = /*#__PURE__*/_interopDefault(s);
|
|
9
|
+
|
|
10
|
+
var a=new tonightpass.Client({baseURL:tonightpass.DEFAULT_API_URL}),E=(t,e,r)=>s__default.default(t,o=>a.get(o,e,r));
|
|
11
|
+
|
|
12
|
+
exports.client = a;
|
|
13
|
+
exports.useAPI = E;
|
|
14
|
+
//# sourceMappingURL=out.js.map
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useAPI.ts"],"names":["useSWR","Client","DEFAULT_API_URL","client","useAPI","path","query","options","key"],"mappings":"AAAA,OAAOA,MAAyB,MAChC,OAGE,UAAAC,EAGA,mBAAAC,MACK,cAEA,IAAMC,EAAS,IAAIF,EAAO,CAAE,QAASC,CAAgB,CAAC,EAEhDE,EAAS,CACpBC,EACAC,EACAC,IAIOP,EACLK,EAH6BG,GAAcL,EAAO,IAAIK,EAAKF,EAAOC,CAAO,CAK3E","sourcesContent":["import useSWR, { Fetcher } from \"swr\";\nimport {\n Endpoints,\n APIRequestOptions,\n Client,\n PathsFor,\n Query,\n DEFAULT_API_URL,\n} from \"tonightpass\";\n\nexport const client = new Client({ baseURL: DEFAULT_API_URL });\n\nexport const useAPI = <Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n) => {\n const fetcher: Fetcher<any> = (key: Path) => client.get(key, query, options);\n\n return useSWR<Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]>(\n path,\n fetcher,\n );\n};\n"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import s from 'swr';
|
|
2
|
+
import { Client, DEFAULT_API_URL } from 'tonightpass';
|
|
3
|
+
|
|
4
|
+
var a=new Client({baseURL:DEFAULT_API_URL}),E=(t,e,r)=>s(t,o=>a.get(o,e,r));
|
|
5
|
+
|
|
6
|
+
export { a as client, E as useAPI };
|
|
7
|
+
//# sourceMappingURL=out.js.map
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useAPI.ts"],"names":["useSWR","Client","DEFAULT_API_URL","client","useAPI","path","query","options","key"],"mappings":"AAAA,OAAOA,MAAyB,MAChC,OAGE,UAAAC,EAGA,mBAAAC,MACK,cAEA,IAAMC,EAAS,IAAIF,EAAO,CAAE,QAASC,CAAgB,CAAC,EAEhDE,EAAS,CACpBC,EACAC,EACAC,IAIOP,EACLK,EAH6BG,GAAcL,EAAO,IAAIK,EAAKF,EAAOC,CAAO,CAK3E","sourcesContent":["import useSWR, { Fetcher } from \"swr\";\nimport {\n Endpoints,\n APIRequestOptions,\n Client,\n PathsFor,\n Query,\n DEFAULT_API_URL,\n} from \"tonightpass\";\n\nexport const client = new Client({ baseURL: DEFAULT_API_URL });\n\nexport const useAPI = <Path extends PathsFor<\"GET\">>(\n path: Path,\n query?: Query<Path>,\n options?: APIRequestOptions,\n) => {\n const fetcher: Fetcher<any> = (key: Path) => client.get(key, query, options);\n\n return useSWR<Extract<Endpoints, { path: Path; method: \"GET\" }>[\"res\"]>(\n path,\n fetcher,\n );\n};\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tonightpass/react",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "@tonightpass react sdk.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/tonightpass/tonightpass.git",
|
|
8
|
+
"directory": "packages/react"
|
|
9
|
+
},
|
|
10
|
+
"bugs": "https://github.com/tonightpass/tonightpass/issues",
|
|
11
|
+
"homepage": "https://tonightpass.com",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"main": "dist/index.js",
|
|
14
|
+
"module": "dist/index.mjs",
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"swr": "^2.2.5",
|
|
18
|
+
"tonightpass": "^0.0.1"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"react": "*"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/react": "^18.0.27",
|
|
25
|
+
"react": "^18.2.0",
|
|
26
|
+
"typescript": "^5.0.0"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsup",
|
|
30
|
+
"dev": "tsup --watch"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useAPI";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import useSWR, { Fetcher } from "swr";
|
|
2
|
+
import {
|
|
3
|
+
Endpoints,
|
|
4
|
+
APIRequestOptions,
|
|
5
|
+
Client,
|
|
6
|
+
PathsFor,
|
|
7
|
+
Query,
|
|
8
|
+
DEFAULT_API_URL,
|
|
9
|
+
} from "tonightpass";
|
|
10
|
+
|
|
11
|
+
export const client = new Client({ baseURL: DEFAULT_API_URL });
|
|
12
|
+
|
|
13
|
+
export const useAPI = <Path extends PathsFor<"GET">>(
|
|
14
|
+
path: Path,
|
|
15
|
+
query?: Query<Path>,
|
|
16
|
+
options?: APIRequestOptions,
|
|
17
|
+
) => {
|
|
18
|
+
const fetcher: Fetcher<any> = (key: Path) => client.get(key, query, options);
|
|
19
|
+
|
|
20
|
+
return useSWR<Extract<Endpoints, { path: Path; method: "GET" }>["res"]>(
|
|
21
|
+
path,
|
|
22
|
+
fetcher,
|
|
23
|
+
);
|
|
24
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./hooks";
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "esnext",
|
|
4
|
+
"resolveJsonModule": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
|
7
|
+
"isolatedModules": true,
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"preserveWatchOutput": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"strictPropertyInitialization": false,
|
|
14
|
+
"experimentalDecorators": true
|
|
15
|
+
},
|
|
16
|
+
"exclude": ["node_modules"]
|
|
17
|
+
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig, Options } from "tsup";
|
|
2
|
+
|
|
3
|
+
const config: Options = {
|
|
4
|
+
format: ["cjs", "esm"],
|
|
5
|
+
entry: ["src/index.ts"],
|
|
6
|
+
splitting: true,
|
|
7
|
+
sourcemap: true,
|
|
8
|
+
clean: false,
|
|
9
|
+
platform: "node",
|
|
10
|
+
minify: true,
|
|
11
|
+
treeshake: true,
|
|
12
|
+
dts: true,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default defineConfig(config);
|