productcraft 0.0.14 → 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/README.md +22 -22
- package/dist/index.cjs +22 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -21
- package/dist/index.d.ts +29 -21
- package/dist/index.js +18 -25
- package/dist/index.js.map +1 -1
- package/package.json +13 -14
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ npm install productcraft
|
|
|
8
8
|
|
|
9
9
|
## When to use this
|
|
10
10
|
|
|
11
|
-
Install **`productcraft`** when you call more than one ProductCraft API from the same backend (e.g. you mint
|
|
11
|
+
Install **`productcraft`** when you call more than one ProductCraft API from the same backend (e.g. you mint Auth tokens *and* send transactional email through Mail). It's a thin wrapper that instantiates one of each per-surface client and shares your auth credential across them.
|
|
12
12
|
|
|
13
13
|
Install the **per-product packages** when you only need one:
|
|
14
14
|
|
|
15
|
-
- `@productcraft/
|
|
16
|
-
- `@productcraft/
|
|
17
|
-
- `@productcraft/
|
|
18
|
-
- `@productcraft/
|
|
15
|
+
- `@productcraft/auth` — customer auth + EndUsers
|
|
16
|
+
- `@productcraft/mail` — receive-and-store mail: template sends, mailboxes, domains + DKIM, webhooks
|
|
17
|
+
- `@productcraft/waitlist` — waitlists: public-form signups, variants, referrals, leaderboard, approvals, signed webhooks
|
|
18
|
+
- `@productcraft/social` — social-as-a-service: communities, posts, feeds, stories, conversations, notifications, moderation
|
|
19
19
|
- `@productcraft/platform-auth` — PlatformUser auth + workspaces + members + roles + IAM policies + PAKs + introspect
|
|
20
20
|
|
|
21
21
|
The per-product packages are leaner (no bundled deps for the surfaces you don't use).
|
|
@@ -29,17 +29,17 @@ const pc = new ProductCraft({
|
|
|
29
29
|
auth: { type: "apiKey", key: process.env.PCFT_KEY! },
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
//
|
|
33
|
-
const consumer = pc.
|
|
32
|
+
// Auth — sign in an EndUser through the BFF flow
|
|
33
|
+
const consumer = pc.auth.consumer("my-app-slug");
|
|
34
34
|
const tokens = await consumer.auth.signin({
|
|
35
35
|
identifier: "alice@example.com",
|
|
36
36
|
password: "...",
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
//
|
|
39
|
+
// Mail — send a template-rendered transactional email from the same backend.
|
|
40
40
|
// The mailboxes-keyed send path does not exist; sends are workspace-scoped
|
|
41
41
|
// template renders.
|
|
42
|
-
await pc.
|
|
42
|
+
await pc.mail.client.POST(
|
|
43
43
|
"/v1/workspaces/{workspace_id}/templates/{name}/send",
|
|
44
44
|
{
|
|
45
45
|
params: {
|
|
@@ -54,8 +54,8 @@ await pc.envoi.client.POST(
|
|
|
54
54
|
},
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
//
|
|
58
|
-
await pc.
|
|
57
|
+
// Waitlist — accept a waitlist signup
|
|
58
|
+
await pc.waitlist.client.POST(
|
|
59
59
|
"/v1/waitlists/{workspaceSlug}/{waitlistSlug}/entries",
|
|
60
60
|
{
|
|
61
61
|
params: { path: { workspaceSlug: "my-workspace", waitlistSlug: "early-access" } },
|
|
@@ -68,15 +68,15 @@ await pc.rally.client.POST(
|
|
|
68
68
|
|
|
69
69
|
```ts
|
|
70
70
|
class ProductCraft {
|
|
71
|
-
readonly
|
|
72
|
-
readonly
|
|
73
|
-
readonly
|
|
74
|
-
readonly
|
|
71
|
+
readonly auth: Auth; // @productcraft/auth
|
|
72
|
+
readonly mail: Mail; // @productcraft/mail
|
|
73
|
+
readonly waitlist: Waitlist; // @productcraft/waitlist
|
|
74
|
+
readonly social: Social; // @productcraft/social
|
|
75
75
|
readonly platformAuth: PlatformAuth; // @productcraft/platform-auth
|
|
76
76
|
}
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
Each is the same class you'd get from installing its per-product package directly — `pc.
|
|
79
|
+
Each is the same class you'd get from installing its per-product package directly — `pc.auth` is `new Auth(config)`, etc. The classes are re-exported so you can refer to their types: `import type { Auth } from "productcraft"`.
|
|
80
80
|
|
|
81
81
|
## Configuration
|
|
82
82
|
|
|
@@ -92,19 +92,19 @@ new ProductCraft({
|
|
|
92
92
|
fetch: customFetch,
|
|
93
93
|
|
|
94
94
|
// Per-surface overrides — useful for dev / staging
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
auth: { baseUrl: "https://api.auth.example.test" },
|
|
96
|
+
mail: { baseUrl: "https://api.mail.example.test" },
|
|
97
|
+
waitlist: { baseUrl: "https://api.waitlist.example.test" },
|
|
98
|
+
social: { baseUrl: "https://social.example.test" },
|
|
99
99
|
platformAuth: { baseUrl: "https://api.auth.example.test" },
|
|
100
100
|
});
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
A per-surface override is merged over the shared config — you can change just the base URL of one surface (e.g. pointing
|
|
103
|
+
A per-surface override is merged over the shared config — you can change just the base URL of one surface (e.g. pointing Auth at a staging cluster while Mail stays on prod) without restating the whole credential.
|
|
104
104
|
|
|
105
105
|
## How these SDKs are built
|
|
106
106
|
|
|
107
|
-
Every surface is generated from its live OpenAPI spec via [`openapi-typescript`](https://openapi-ts.dev/) (types) + [`openapi-fetch`](https://openapi-ts.dev/openapi-fetch/) (runtime).
|
|
107
|
+
Every surface is generated from its live OpenAPI spec via [`openapi-typescript`](https://openapi-ts.dev/) (types) + [`openapi-fetch`](https://openapi-ts.dev/openapi-fetch/) (runtime). Auth additionally has a hand-written ergonomic layer (`consumer(slug).auth.signin(...)`) on top of the generated client; the other surfaces ship the `client` directly for now.
|
|
108
108
|
|
|
109
109
|
## License
|
|
110
110
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,51 +1,44 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var auth = require('@productcraft/auth');
|
|
4
|
+
var mail = require('@productcraft/mail');
|
|
5
|
+
var waitlist = require('@productcraft/waitlist');
|
|
6
|
+
var social = require('@productcraft/social');
|
|
7
7
|
var platformAuth = require('@productcraft/platform-auth');
|
|
8
8
|
var core = require('@productcraft/core');
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
var ProductCraft = class {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
auth;
|
|
13
|
+
mail;
|
|
14
|
+
waitlist;
|
|
15
|
+
social;
|
|
16
16
|
platformAuth;
|
|
17
17
|
constructor(config = {}) {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
...shared
|
|
25
|
-
} = config;
|
|
26
|
-
this.heimdall = new heimdall.Heimdall({ ...shared, ...hOverride });
|
|
27
|
-
this.envoi = new envoi.Envoi({ ...shared, ...eOverride });
|
|
28
|
-
this.rally = new rally.Rally({ ...shared, ...rOverride });
|
|
29
|
-
this.agora = new agora.Agora({ ...shared, ...aOverride });
|
|
30
|
-
this.platformAuth = new platformAuth.PlatformAuth({ ...shared, ...pOverride });
|
|
18
|
+
const { overrides, ...shared } = config;
|
|
19
|
+
this.auth = new auth.Auth({ ...shared, ...overrides?.auth });
|
|
20
|
+
this.mail = new mail.Mail({ ...shared, ...overrides?.mail });
|
|
21
|
+
this.waitlist = new waitlist.Waitlist({ ...shared, ...overrides?.waitlist });
|
|
22
|
+
this.social = new social.Social({ ...shared, ...overrides?.social });
|
|
23
|
+
this.platformAuth = new platformAuth.PlatformAuth({ ...shared, ...overrides?.platformAuth });
|
|
31
24
|
}
|
|
32
25
|
};
|
|
33
26
|
|
|
34
|
-
Object.defineProperty(exports, "
|
|
27
|
+
Object.defineProperty(exports, "Auth", {
|
|
35
28
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
29
|
+
get: function () { return auth.Auth; }
|
|
37
30
|
});
|
|
38
|
-
Object.defineProperty(exports, "
|
|
31
|
+
Object.defineProperty(exports, "Mail", {
|
|
39
32
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
33
|
+
get: function () { return mail.Mail; }
|
|
41
34
|
});
|
|
42
|
-
Object.defineProperty(exports, "
|
|
35
|
+
Object.defineProperty(exports, "Waitlist", {
|
|
43
36
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
37
|
+
get: function () { return waitlist.Waitlist; }
|
|
45
38
|
});
|
|
46
|
-
Object.defineProperty(exports, "
|
|
39
|
+
Object.defineProperty(exports, "Social", {
|
|
47
40
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
41
|
+
get: function () { return social.Social; }
|
|
49
42
|
});
|
|
50
43
|
Object.defineProperty(exports, "PlatformAuth", {
|
|
51
44
|
enumerable: true,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["Auth","Mail","Waitlist","Social","PlatformAuth"],"mappings":";;;;;;;;;;AAkDO,IAAM,eAAN,MAAmB;AAAA,EACR,IAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,EAEhB,WAAA,CACE,MAAA,GAAiE,EAAC,EAClE;AACA,IAAA,MAAM,EAAE,SAAA,EAAW,GAAG,MAAA,EAAO,GAAI,MAAA;AACjC,IAAA,IAAA,CAAK,IAAA,GAAO,IAAIA,SAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,IAAA,EAAM,CAAA;AACtD,IAAA,IAAA,CAAK,IAAA,GAAO,IAAIC,SAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,IAAA,EAAM,CAAA;AACtD,IAAA,IAAA,CAAK,QAAA,GAAW,IAAIC,iBAAA,CAAS,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,QAAA,EAAU,CAAA;AAClE,IAAA,IAAA,CAAK,MAAA,GAAS,IAAIC,aAAA,CAAO,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,MAAA,EAAQ,CAAA;AAC5D,IAAA,IAAA,CAAK,YAAA,GAAe,IAAIC,yBAAA,CAAa,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,YAAA,EAAc,CAAA;AAAA,EAChF;AACF","file":"index.cjs","sourcesContent":["/**\n * `productcraft` — single import that gives you every API surface.\n *\n * ```ts\n * import { ProductCraft } from \"productcraft\";\n *\n * const pc = new ProductCraft({\n * auth: { type: \"apiKey\", key: \"pcft_live_...\" },\n * });\n *\n * const { data, error } = await pc.mail.client.POST(\n * \"/v1/mailboxes/{mailboxId}/messages/send\",\n * { params: { path: { mailboxId: \"...\" } }, body: { ... } }\n * );\n * ```\n *\n * If you only need one product, install its package directly:\n * `npm i @productcraft/auth` (and skip this umbrella).\n */\n\nimport { Auth } from \"@productcraft/auth\";\nimport { Mail } from \"@productcraft/mail\";\nimport { Waitlist } from \"@productcraft/waitlist\";\nimport { Social } from \"@productcraft/social\";\nimport { PlatformAuth } from \"@productcraft/platform-auth\";\nimport type { PCClientConfig } from \"@productcraft/core\";\n\nexport { Auth, Mail, Waitlist, Social, PlatformAuth };\nexport { PC_BASE_URL, type PCAuth, type PCClientConfig } from \"@productcraft/core\";\n\n/**\n * Per-surface config overrides. Nested under `overrides` (rather than\n * flat keys) because the Auth surface's natural key — `auth` — would\n * collide with the shared `auth` credential field on `PCClientConfig`.\n */\nexport interface ProductCraftOverrides {\n auth?: PCClientConfig;\n mail?: PCClientConfig;\n waitlist?: PCClientConfig;\n social?: PCClientConfig;\n platformAuth?: PCClientConfig;\n}\n\n/**\n * The umbrella class — instantiates one of each surface client, all\n * sharing the same auth + fetch + (optional) baseUrl override config.\n *\n * Surface-specific overrides are also possible:\n * `new ProductCraft({ auth, overrides: { mail: { baseUrl: \"...\" } } })`.\n */\nexport class ProductCraft {\n public readonly auth: Auth;\n public readonly mail: Mail;\n public readonly waitlist: Waitlist;\n public readonly social: Social;\n public readonly platformAuth: PlatformAuth;\n\n constructor(\n config: PCClientConfig & { overrides?: ProductCraftOverrides } = {},\n ) {\n const { overrides, ...shared } = config;\n this.auth = new Auth({ ...shared, ...overrides?.auth });\n this.mail = new Mail({ ...shared, ...overrides?.mail });\n this.waitlist = new Waitlist({ ...shared, ...overrides?.waitlist });\n this.social = new Social({ ...shared, ...overrides?.social });\n this.platformAuth = new PlatformAuth({ ...shared, ...overrides?.platformAuth });\n }\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
1
|
+
import { Auth } from '@productcraft/auth';
|
|
2
|
+
export { Auth } from '@productcraft/auth';
|
|
3
|
+
import { Mail } from '@productcraft/mail';
|
|
4
|
+
export { Mail } from '@productcraft/mail';
|
|
5
|
+
import { Waitlist } from '@productcraft/waitlist';
|
|
6
|
+
export { Waitlist } from '@productcraft/waitlist';
|
|
7
|
+
import { Social } from '@productcraft/social';
|
|
8
|
+
export { Social } from '@productcraft/social';
|
|
9
9
|
import { PlatformAuth } from '@productcraft/platform-auth';
|
|
10
10
|
export { PlatformAuth } from '@productcraft/platform-auth';
|
|
11
11
|
import { PCClientConfig } from '@productcraft/core';
|
|
@@ -21,36 +21,44 @@ export { PCAuth, PCClientConfig, PC_BASE_URL } from '@productcraft/core';
|
|
|
21
21
|
* auth: { type: "apiKey", key: "pcft_live_..." },
|
|
22
22
|
* });
|
|
23
23
|
*
|
|
24
|
-
* const { data, error } = await pc.
|
|
24
|
+
* const { data, error } = await pc.mail.client.POST(
|
|
25
25
|
* "/v1/mailboxes/{mailboxId}/messages/send",
|
|
26
26
|
* { params: { path: { mailboxId: "..." } }, body: { ... } }
|
|
27
27
|
* );
|
|
28
28
|
* ```
|
|
29
29
|
*
|
|
30
30
|
* If you only need one product, install its package directly:
|
|
31
|
-
* `npm i @productcraft/
|
|
31
|
+
* `npm i @productcraft/auth` (and skip this umbrella).
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Per-surface config overrides. Nested under `overrides` (rather than
|
|
36
|
+
* flat keys) because the Auth surface's natural key — `auth` — would
|
|
37
|
+
* collide with the shared `auth` credential field on `PCClientConfig`.
|
|
38
|
+
*/
|
|
39
|
+
interface ProductCraftOverrides {
|
|
40
|
+
auth?: PCClientConfig;
|
|
41
|
+
mail?: PCClientConfig;
|
|
42
|
+
waitlist?: PCClientConfig;
|
|
43
|
+
social?: PCClientConfig;
|
|
44
|
+
platformAuth?: PCClientConfig;
|
|
45
|
+
}
|
|
34
46
|
/**
|
|
35
47
|
* The umbrella class — instantiates one of each surface client, all
|
|
36
48
|
* sharing the same auth + fetch + (optional) baseUrl override config.
|
|
37
49
|
*
|
|
38
50
|
* Surface-specific overrides are also possible:
|
|
39
|
-
* `new ProductCraft({ auth,
|
|
51
|
+
* `new ProductCraft({ auth, overrides: { mail: { baseUrl: "..." } } })`.
|
|
40
52
|
*/
|
|
41
53
|
declare class ProductCraft {
|
|
42
|
-
readonly
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
54
|
+
readonly auth: Auth;
|
|
55
|
+
readonly mail: Mail;
|
|
56
|
+
readonly waitlist: Waitlist;
|
|
57
|
+
readonly social: Social;
|
|
46
58
|
readonly platformAuth: PlatformAuth;
|
|
47
59
|
constructor(config?: PCClientConfig & {
|
|
48
|
-
|
|
49
|
-
envoi?: PCClientConfig;
|
|
50
|
-
rally?: PCClientConfig;
|
|
51
|
-
agora?: PCClientConfig;
|
|
52
|
-
platformAuth?: PCClientConfig;
|
|
60
|
+
overrides?: ProductCraftOverrides;
|
|
53
61
|
});
|
|
54
62
|
}
|
|
55
63
|
|
|
56
|
-
export { ProductCraft };
|
|
64
|
+
export { ProductCraft, type ProductCraftOverrides };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
1
|
+
import { Auth } from '@productcraft/auth';
|
|
2
|
+
export { Auth } from '@productcraft/auth';
|
|
3
|
+
import { Mail } from '@productcraft/mail';
|
|
4
|
+
export { Mail } from '@productcraft/mail';
|
|
5
|
+
import { Waitlist } from '@productcraft/waitlist';
|
|
6
|
+
export { Waitlist } from '@productcraft/waitlist';
|
|
7
|
+
import { Social } from '@productcraft/social';
|
|
8
|
+
export { Social } from '@productcraft/social';
|
|
9
9
|
import { PlatformAuth } from '@productcraft/platform-auth';
|
|
10
10
|
export { PlatformAuth } from '@productcraft/platform-auth';
|
|
11
11
|
import { PCClientConfig } from '@productcraft/core';
|
|
@@ -21,36 +21,44 @@ export { PCAuth, PCClientConfig, PC_BASE_URL } from '@productcraft/core';
|
|
|
21
21
|
* auth: { type: "apiKey", key: "pcft_live_..." },
|
|
22
22
|
* });
|
|
23
23
|
*
|
|
24
|
-
* const { data, error } = await pc.
|
|
24
|
+
* const { data, error } = await pc.mail.client.POST(
|
|
25
25
|
* "/v1/mailboxes/{mailboxId}/messages/send",
|
|
26
26
|
* { params: { path: { mailboxId: "..." } }, body: { ... } }
|
|
27
27
|
* );
|
|
28
28
|
* ```
|
|
29
29
|
*
|
|
30
30
|
* If you only need one product, install its package directly:
|
|
31
|
-
* `npm i @productcraft/
|
|
31
|
+
* `npm i @productcraft/auth` (and skip this umbrella).
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Per-surface config overrides. Nested under `overrides` (rather than
|
|
36
|
+
* flat keys) because the Auth surface's natural key — `auth` — would
|
|
37
|
+
* collide with the shared `auth` credential field on `PCClientConfig`.
|
|
38
|
+
*/
|
|
39
|
+
interface ProductCraftOverrides {
|
|
40
|
+
auth?: PCClientConfig;
|
|
41
|
+
mail?: PCClientConfig;
|
|
42
|
+
waitlist?: PCClientConfig;
|
|
43
|
+
social?: PCClientConfig;
|
|
44
|
+
platformAuth?: PCClientConfig;
|
|
45
|
+
}
|
|
34
46
|
/**
|
|
35
47
|
* The umbrella class — instantiates one of each surface client, all
|
|
36
48
|
* sharing the same auth + fetch + (optional) baseUrl override config.
|
|
37
49
|
*
|
|
38
50
|
* Surface-specific overrides are also possible:
|
|
39
|
-
* `new ProductCraft({ auth,
|
|
51
|
+
* `new ProductCraft({ auth, overrides: { mail: { baseUrl: "..." } } })`.
|
|
40
52
|
*/
|
|
41
53
|
declare class ProductCraft {
|
|
42
|
-
readonly
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
54
|
+
readonly auth: Auth;
|
|
55
|
+
readonly mail: Mail;
|
|
56
|
+
readonly waitlist: Waitlist;
|
|
57
|
+
readonly social: Social;
|
|
46
58
|
readonly platformAuth: PlatformAuth;
|
|
47
59
|
constructor(config?: PCClientConfig & {
|
|
48
|
-
|
|
49
|
-
envoi?: PCClientConfig;
|
|
50
|
-
rally?: PCClientConfig;
|
|
51
|
-
agora?: PCClientConfig;
|
|
52
|
-
platformAuth?: PCClientConfig;
|
|
60
|
+
overrides?: ProductCraftOverrides;
|
|
53
61
|
});
|
|
54
62
|
}
|
|
55
63
|
|
|
56
|
-
export { ProductCraft };
|
|
64
|
+
export { ProductCraft, type ProductCraftOverrides };
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
1
|
+
import { Auth } from '@productcraft/auth';
|
|
2
|
+
export { Auth } from '@productcraft/auth';
|
|
3
|
+
import { Mail } from '@productcraft/mail';
|
|
4
|
+
export { Mail } from '@productcraft/mail';
|
|
5
|
+
import { Waitlist } from '@productcraft/waitlist';
|
|
6
|
+
export { Waitlist } from '@productcraft/waitlist';
|
|
7
|
+
import { Social } from '@productcraft/social';
|
|
8
|
+
export { Social } from '@productcraft/social';
|
|
9
9
|
import { PlatformAuth } from '@productcraft/platform-auth';
|
|
10
10
|
export { PlatformAuth } from '@productcraft/platform-auth';
|
|
11
11
|
export { PC_BASE_URL } from '@productcraft/core';
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
var ProductCraft = class {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
auth;
|
|
16
|
+
mail;
|
|
17
|
+
waitlist;
|
|
18
|
+
social;
|
|
19
19
|
platformAuth;
|
|
20
20
|
constructor(config = {}) {
|
|
21
|
-
const {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...shared
|
|
28
|
-
} = config;
|
|
29
|
-
this.heimdall = new Heimdall({ ...shared, ...hOverride });
|
|
30
|
-
this.envoi = new Envoi({ ...shared, ...eOverride });
|
|
31
|
-
this.rally = new Rally({ ...shared, ...rOverride });
|
|
32
|
-
this.agora = new Agora({ ...shared, ...aOverride });
|
|
33
|
-
this.platformAuth = new PlatformAuth({ ...shared, ...pOverride });
|
|
21
|
+
const { overrides, ...shared } = config;
|
|
22
|
+
this.auth = new Auth({ ...shared, ...overrides?.auth });
|
|
23
|
+
this.mail = new Mail({ ...shared, ...overrides?.mail });
|
|
24
|
+
this.waitlist = new Waitlist({ ...shared, ...overrides?.waitlist });
|
|
25
|
+
this.social = new Social({ ...shared, ...overrides?.social });
|
|
26
|
+
this.platformAuth = new PlatformAuth({ ...shared, ...overrides?.platformAuth });
|
|
34
27
|
}
|
|
35
28
|
};
|
|
36
29
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAkDO,IAAM,eAAN,MAAmB;AAAA,EACR,IAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAA;AAAA,EAEhB,WAAA,CACE,MAAA,GAAiE,EAAC,EAClE;AACA,IAAA,MAAM,EAAE,SAAA,EAAW,GAAG,MAAA,EAAO,GAAI,MAAA;AACjC,IAAA,IAAA,CAAK,IAAA,GAAO,IAAI,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,IAAA,EAAM,CAAA;AACtD,IAAA,IAAA,CAAK,IAAA,GAAO,IAAI,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,IAAA,EAAM,CAAA;AACtD,IAAA,IAAA,CAAK,QAAA,GAAW,IAAI,QAAA,CAAS,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,QAAA,EAAU,CAAA;AAClE,IAAA,IAAA,CAAK,MAAA,GAAS,IAAI,MAAA,CAAO,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,MAAA,EAAQ,CAAA;AAC5D,IAAA,IAAA,CAAK,YAAA,GAAe,IAAI,YAAA,CAAa,EAAE,GAAG,MAAA,EAAQ,GAAG,SAAA,EAAW,YAAA,EAAc,CAAA;AAAA,EAChF;AACF","file":"index.js","sourcesContent":["/**\n * `productcraft` — single import that gives you every API surface.\n *\n * ```ts\n * import { ProductCraft } from \"productcraft\";\n *\n * const pc = new ProductCraft({\n * auth: { type: \"apiKey\", key: \"pcft_live_...\" },\n * });\n *\n * const { data, error } = await pc.mail.client.POST(\n * \"/v1/mailboxes/{mailboxId}/messages/send\",\n * { params: { path: { mailboxId: \"...\" } }, body: { ... } }\n * );\n * ```\n *\n * If you only need one product, install its package directly:\n * `npm i @productcraft/auth` (and skip this umbrella).\n */\n\nimport { Auth } from \"@productcraft/auth\";\nimport { Mail } from \"@productcraft/mail\";\nimport { Waitlist } from \"@productcraft/waitlist\";\nimport { Social } from \"@productcraft/social\";\nimport { PlatformAuth } from \"@productcraft/platform-auth\";\nimport type { PCClientConfig } from \"@productcraft/core\";\n\nexport { Auth, Mail, Waitlist, Social, PlatformAuth };\nexport { PC_BASE_URL, type PCAuth, type PCClientConfig } from \"@productcraft/core\";\n\n/**\n * Per-surface config overrides. Nested under `overrides` (rather than\n * flat keys) because the Auth surface's natural key — `auth` — would\n * collide with the shared `auth` credential field on `PCClientConfig`.\n */\nexport interface ProductCraftOverrides {\n auth?: PCClientConfig;\n mail?: PCClientConfig;\n waitlist?: PCClientConfig;\n social?: PCClientConfig;\n platformAuth?: PCClientConfig;\n}\n\n/**\n * The umbrella class — instantiates one of each surface client, all\n * sharing the same auth + fetch + (optional) baseUrl override config.\n *\n * Surface-specific overrides are also possible:\n * `new ProductCraft({ auth, overrides: { mail: { baseUrl: \"...\" } } })`.\n */\nexport class ProductCraft {\n public readonly auth: Auth;\n public readonly mail: Mail;\n public readonly waitlist: Waitlist;\n public readonly social: Social;\n public readonly platformAuth: PlatformAuth;\n\n constructor(\n config: PCClientConfig & { overrides?: ProductCraftOverrides } = {},\n ) {\n const { overrides, ...shared } = config;\n this.auth = new Auth({ ...shared, ...overrides?.auth });\n this.mail = new Mail({ ...shared, ...overrides?.mail });\n this.waitlist = new Waitlist({ ...shared, ...overrides?.waitlist });\n this.social = new Social({ ...shared, ...overrides?.social });\n this.platformAuth = new PlatformAuth({ ...shared, ...overrides?.platformAuth });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "productcraft",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "All-in-one Node.js / TypeScript SDK for the ProductCraft platform —
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "All-in-one Node.js / TypeScript SDK for the ProductCraft platform — Auth, Mail, Waitlist, Social, and Platform-Auth from a single import. Install per-product packages (`@productcraft/auth`, ...) if you only need one.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"keywords": [
|
|
25
25
|
"productcraft",
|
|
26
26
|
"sdk",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
27
|
+
"auth",
|
|
28
|
+
"mail",
|
|
29
|
+
"waitlist",
|
|
30
|
+
"social",
|
|
31
31
|
"auth",
|
|
32
32
|
"email",
|
|
33
33
|
"waitlist",
|
|
@@ -42,16 +42,15 @@
|
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://github.com/clauderanelagh/productcraft-node",
|
|
44
44
|
"publishConfig": {
|
|
45
|
-
"access": "public"
|
|
46
|
-
"provenance": true
|
|
45
|
+
"access": "public"
|
|
47
46
|
},
|
|
48
47
|
"dependencies": {
|
|
49
|
-
"@productcraft/
|
|
50
|
-
"@productcraft/core": "^0.0
|
|
51
|
-
"@productcraft/
|
|
52
|
-
"@productcraft/
|
|
53
|
-
"@productcraft/platform-auth": "^0.0.
|
|
54
|
-
"@productcraft/
|
|
48
|
+
"@productcraft/social": "^0.1.0",
|
|
49
|
+
"@productcraft/core": "^0.1.0",
|
|
50
|
+
"@productcraft/mail": "^0.1.0",
|
|
51
|
+
"@productcraft/auth": "^0.5.0",
|
|
52
|
+
"@productcraft/platform-auth": "^0.0.11",
|
|
53
|
+
"@productcraft/waitlist": "^0.1.0"
|
|
55
54
|
},
|
|
56
55
|
"scripts": {
|
|
57
56
|
"build": "tsup",
|