tonightpass 0.0.0 → 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 -17
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts +585 -0
- package/dist/index.d.ts +228 -52
- package/dist/index.js +43 -471
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +14 -5
- package/src/constants/api.ts +1 -0
- package/src/constants/index.ts +2 -0
- package/src/constants/regex.ts +20 -0
- package/src/index.ts +4 -3
- package/src/rest/client.ts +155 -0
- package/src/rest/dtos/index.ts +3 -0
- package/src/rest/dtos/users/create-user.dto.ts +16 -0
- package/src/rest/dtos/users/index.ts +3 -0
- package/src/rest/dtos/users/sign-in-user.dto.ts +4 -0
- package/src/rest/dtos/users/update-user.dto.ts +116 -0
- package/src/rest/endpoints.ts +41 -0
- package/src/rest/index.ts +5 -0
- package/src/rest/request/index.ts +1 -0
- package/src/rest/request/request.ts +30 -0
- package/src/rest/types/api/index.ts +0 -0
- package/src/rest/types/careers/index.ts +87 -0
- package/src/rest/types/event/index.ts +60 -0
- package/src/rest/types/event/ticket/index.ts +36 -0
- package/src/rest/types/health/index.ts +17 -0
- package/src/rest/types/index.ts +33 -0
- package/src/rest/types/order/index.ts +46 -0
- package/src/rest/types/organizations/index.ts +54 -0
- package/src/rest/types/profiles/index.ts +30 -0
- package/src/rest/types/token/index.ts +15 -0
- package/src/rest/types/users/index.ts +104 -0
- package/src/sdk/builder.ts +5 -0
- package/src/sdk/careers.ts +22 -0
- package/src/sdk/health.ts +6 -0
- package/src/sdk/index.ts +3 -0
- package/src/sdk/profiles.ts +6 -0
- package/src/sdk/users.ts +12 -0
- package/src/tonightpass.ts +19 -0
- package/src/utils/index.ts +1 -0
- package/tests/careers/index.ts +28 -0
- package/tests/index.ts +57 -0
- package/tsconfig.json +3 -1
- package/tsup.config.ts +5 -2
package/tests/index.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
|
|
3
|
+
import assert from "node:assert";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
|
|
6
|
+
import { careersTests } from "./careers";
|
|
7
|
+
import { TonightPass } from "../src/tonightpass";
|
|
8
|
+
|
|
9
|
+
const sdkTests = [careersTests];
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
+
// @ts-expect-error
|
|
13
|
+
globalThis.TSUP_IS_NODE = true;
|
|
14
|
+
|
|
15
|
+
const API_URL =
|
|
16
|
+
process.env.TEST_TONIGHTPASS_API_BASE_URL ??
|
|
17
|
+
"https://api.staging.tonightpass.com";
|
|
18
|
+
|
|
19
|
+
const tnp = new TonightPass({
|
|
20
|
+
baseURL: API_URL,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("The HTTP client correctly forms URLs", () => {
|
|
24
|
+
assert.equal(
|
|
25
|
+
tnp.client.url("/path/to/:resource", {
|
|
26
|
+
resource: "my-resource",
|
|
27
|
+
limit: 20,
|
|
28
|
+
skip: 20,
|
|
29
|
+
}),
|
|
30
|
+
API_URL + "/path/to/my-resource?limit=20&skip=20",
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
assert.equal(
|
|
34
|
+
tnp.client.url("/path/to/:resource", {
|
|
35
|
+
resource: "my-resource",
|
|
36
|
+
limit: 20,
|
|
37
|
+
}),
|
|
38
|
+
API_URL + "/path/to/my-resource?limit=20",
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
assert.equal(
|
|
42
|
+
tnp.client.url("/path/to/:resource/:param", {
|
|
43
|
+
resource: "my-resource",
|
|
44
|
+
param: "param2",
|
|
45
|
+
limit: 20,
|
|
46
|
+
}),
|
|
47
|
+
API_URL + "/path/to/my-resource/param2?limit=20",
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test("The HTTP client can make a request", async () => {
|
|
52
|
+
await assert.doesNotReject(() => tnp.client.get("/health/http"));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
for (const sdkTest of sdkTests) {
|
|
56
|
+
sdkTest(tnp);
|
|
57
|
+
}
|
package/tsconfig.json
CHANGED
package/tsup.config.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { defineConfig, Options } from "tsup";
|
|
2
2
|
|
|
3
3
|
const config: Options = {
|
|
4
|
+
format: ["cjs", "esm"],
|
|
4
5
|
entry: ["src/index.ts"],
|
|
5
|
-
splitting:
|
|
6
|
+
splitting: true,
|
|
6
7
|
sourcemap: true,
|
|
7
|
-
clean:
|
|
8
|
+
clean: false,
|
|
8
9
|
platform: "node",
|
|
10
|
+
minify: true,
|
|
11
|
+
treeshake: true,
|
|
9
12
|
dts: true,
|
|
10
13
|
};
|
|
11
14
|
|