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.
Files changed (46) hide show
  1. package/.turbo/turbo-build.log +21 -17
  2. package/CHANGELOG.md +7 -0
  3. package/dist/index.d.mts +585 -0
  4. package/dist/index.d.ts +228 -52
  5. package/dist/index.js +43 -471
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +11 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +14 -5
  10. package/src/constants/api.ts +1 -0
  11. package/src/constants/index.ts +2 -0
  12. package/src/constants/regex.ts +20 -0
  13. package/src/index.ts +4 -3
  14. package/src/rest/client.ts +155 -0
  15. package/src/rest/dtos/index.ts +3 -0
  16. package/src/rest/dtos/users/create-user.dto.ts +16 -0
  17. package/src/rest/dtos/users/index.ts +3 -0
  18. package/src/rest/dtos/users/sign-in-user.dto.ts +4 -0
  19. package/src/rest/dtos/users/update-user.dto.ts +116 -0
  20. package/src/rest/endpoints.ts +41 -0
  21. package/src/rest/index.ts +5 -0
  22. package/src/rest/request/index.ts +1 -0
  23. package/src/rest/request/request.ts +30 -0
  24. package/src/rest/types/api/index.ts +0 -0
  25. package/src/rest/types/careers/index.ts +87 -0
  26. package/src/rest/types/event/index.ts +60 -0
  27. package/src/rest/types/event/ticket/index.ts +36 -0
  28. package/src/rest/types/health/index.ts +17 -0
  29. package/src/rest/types/index.ts +33 -0
  30. package/src/rest/types/order/index.ts +46 -0
  31. package/src/rest/types/organizations/index.ts +54 -0
  32. package/src/rest/types/profiles/index.ts +30 -0
  33. package/src/rest/types/token/index.ts +15 -0
  34. package/src/rest/types/users/index.ts +104 -0
  35. package/src/sdk/builder.ts +5 -0
  36. package/src/sdk/careers.ts +22 -0
  37. package/src/sdk/health.ts +6 -0
  38. package/src/sdk/index.ts +3 -0
  39. package/src/sdk/profiles.ts +6 -0
  40. package/src/sdk/users.ts +12 -0
  41. package/src/tonightpass.ts +19 -0
  42. package/src/utils/index.ts +1 -0
  43. package/tests/careers/index.ts +28 -0
  44. package/tests/index.ts +57 -0
  45. package/tsconfig.json +3 -1
  46. 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
@@ -9,7 +9,9 @@
9
9
  "preserveWatchOutput": true,
10
10
  "skipLibCheck": true,
11
11
  "noEmit": true,
12
- "strict": true
12
+ "strict": true,
13
+ "strictPropertyInitialization": false,
14
+ "experimentalDecorators": true
13
15
  },
14
16
  "exclude": ["node_modules"]
15
17
  }
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: false,
6
+ splitting: true,
6
7
  sourcemap: true,
7
- clean: true,
8
+ clean: false,
8
9
  platform: "node",
10
+ minify: true,
11
+ treeshake: true,
9
12
  dts: true,
10
13
  };
11
14