productcraft 0.0.13 → 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 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 Heimdall tokens *and* send transactional email through Envoi). It's a thin wrapper that instantiates one of each per-surface client and shares your auth credential across them.
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/heimdall` — customer auth + EndUsers
16
- - `@productcraft/envoi` — receive-and-store mail: template sends, mailboxes, domains + DKIM, webhooks
17
- - `@productcraft/rally` — waitlists: public-form signups, variants, referrals, leaderboard, approvals, signed webhooks
18
- - `@productcraft/agora` — social-as-a-service: communities, posts, feeds, stories, conversations, notifications, moderation
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
- // Heimdall — sign in an EndUser through the BFF flow
33
- const consumer = pc.heimdall.consumer("my-app-slug");
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
- // Envoi — send a template-rendered transactional email from the same backend.
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.envoi.client.POST(
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
- // Rally — accept a waitlist signup
58
- await pc.rally.client.POST(
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 heimdall: Heimdall; // @productcraft/heimdall
72
- readonly envoi: Envoi; // @productcraft/envoi
73
- readonly rally: Rally; // @productcraft/rally
74
- readonly agora: Agora; // @productcraft/agora
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.heimdall` is `new Heimdall(config)`, etc. The classes are re-exported so you can refer to their types: `import type { Heimdall } from "productcraft"`.
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
- heimdall: { baseUrl: "https://api.heimdall.example.test" },
96
- envoi: { baseUrl: "https://api.mail.example.test" },
97
- rally: { baseUrl: "https://api.rally.example.test" },
98
- agora: { baseUrl: "https://agora.example.test" },
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 Heimdall at a staging cluster while Envoi stays on prod) without restating the whole credential.
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). Heimdall 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.
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 heimdall = require('@productcraft/heimdall');
4
- var envoi = require('@productcraft/envoi');
5
- var rally = require('@productcraft/rally');
6
- var agora = require('@productcraft/agora');
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
- heimdall;
13
- envoi;
14
- rally;
15
- agora;
12
+ auth;
13
+ mail;
14
+ waitlist;
15
+ social;
16
16
  platformAuth;
17
17
  constructor(config = {}) {
18
- const {
19
- heimdall: hOverride,
20
- envoi: eOverride,
21
- rally: rOverride,
22
- agora: aOverride,
23
- platformAuth: pOverride,
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, "Heimdall", {
27
+ Object.defineProperty(exports, "Auth", {
35
28
  enumerable: true,
36
- get: function () { return heimdall.Heimdall; }
29
+ get: function () { return auth.Auth; }
37
30
  });
38
- Object.defineProperty(exports, "Envoi", {
31
+ Object.defineProperty(exports, "Mail", {
39
32
  enumerable: true,
40
- get: function () { return envoi.Envoi; }
33
+ get: function () { return mail.Mail; }
41
34
  });
42
- Object.defineProperty(exports, "Rally", {
35
+ Object.defineProperty(exports, "Waitlist", {
43
36
  enumerable: true,
44
- get: function () { return rally.Rally; }
37
+ get: function () { return waitlist.Waitlist; }
45
38
  });
46
- Object.defineProperty(exports, "Agora", {
39
+ Object.defineProperty(exports, "Social", {
47
40
  enumerable: true,
48
- get: function () { return agora.Agora; }
41
+ get: function () { return social.Social; }
49
42
  });
50
43
  Object.defineProperty(exports, "PlatformAuth", {
51
44
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["Heimdall","Envoi","Rally","Agora","PlatformAuth"],"mappings":";;;;;;;;;;AAqCO,IAAM,eAAN,MAAmB;AAAA,EACR,QAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA;AAAA,EAEhB,WAAA,CACE,MAAA,GAMI,EAAC,EACL;AACA,IAAA,MAAM;AAAA,MACJ,QAAA,EAAU,SAAA;AAAA,MACV,KAAA,EAAO,SAAA;AAAA,MACP,KAAA,EAAO,SAAA;AAAA,MACP,KAAA,EAAO,SAAA;AAAA,MACP,YAAA,EAAc,SAAA;AAAA,MACd,GAAG;AAAA,KACL,GAAI,MAAA;AACJ,IAAA,IAAA,CAAK,QAAA,GAAW,IAAIA,iBAAA,CAAS,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AACxD,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAIC,WAAA,CAAM,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AAClD,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAIC,WAAA,CAAM,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AAClD,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAIC,WAAA,CAAM,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AAClD,IAAA,IAAA,CAAK,YAAA,GAAe,IAAIC,yBAAA,CAAa,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AAAA,EAClE;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.envoi.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/heimdall` (and skip this umbrella).\n */\n\nimport { Heimdall } from \"@productcraft/heimdall\";\nimport { Envoi } from \"@productcraft/envoi\";\nimport { Rally } from \"@productcraft/rally\";\nimport { Agora } from \"@productcraft/agora\";\nimport { PlatformAuth } from \"@productcraft/platform-auth\";\nimport type { PCClientConfig } from \"@productcraft/core\";\n\nexport { Heimdall, Envoi, Rally, Agora, PlatformAuth };\nexport { PC_BASE_URL, type PCAuth, type PCClientConfig } from \"@productcraft/core\";\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, heimdall: { baseUrl: \"...\" } })`.\n */\nexport class ProductCraft {\n public readonly heimdall: Heimdall;\n public readonly envoi: Envoi;\n public readonly rally: Rally;\n public readonly agora: Agora;\n public readonly platformAuth: PlatformAuth;\n\n constructor(\n config: PCClientConfig & {\n heimdall?: PCClientConfig;\n envoi?: PCClientConfig;\n rally?: PCClientConfig;\n agora?: PCClientConfig;\n platformAuth?: PCClientConfig;\n } = {},\n ) {\n const {\n heimdall: hOverride,\n envoi: eOverride,\n rally: rOverride,\n agora: aOverride,\n platformAuth: pOverride,\n ...shared\n } = config;\n this.heimdall = new Heimdall({ ...shared, ...hOverride });\n this.envoi = new Envoi({ ...shared, ...eOverride });\n this.rally = new Rally({ ...shared, ...rOverride });\n this.agora = new Agora({ ...shared, ...aOverride });\n this.platformAuth = new PlatformAuth({ ...shared, ...pOverride });\n }\n}\n"]}
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 { Heimdall } from '@productcraft/heimdall';
2
- export { Heimdall } from '@productcraft/heimdall';
3
- import { Envoi } from '@productcraft/envoi';
4
- export { Envoi } from '@productcraft/envoi';
5
- import { Rally } from '@productcraft/rally';
6
- export { Rally } from '@productcraft/rally';
7
- import { Agora } from '@productcraft/agora';
8
- export { Agora } from '@productcraft/agora';
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.envoi.client.POST(
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/heimdall` (and skip this umbrella).
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, heimdall: { baseUrl: "..." } })`.
51
+ * `new ProductCraft({ auth, overrides: { mail: { baseUrl: "..." } } })`.
40
52
  */
41
53
  declare class ProductCraft {
42
- readonly heimdall: Heimdall;
43
- readonly envoi: Envoi;
44
- readonly rally: Rally;
45
- readonly agora: Agora;
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
- heimdall?: PCClientConfig;
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 { Heimdall } from '@productcraft/heimdall';
2
- export { Heimdall } from '@productcraft/heimdall';
3
- import { Envoi } from '@productcraft/envoi';
4
- export { Envoi } from '@productcraft/envoi';
5
- import { Rally } from '@productcraft/rally';
6
- export { Rally } from '@productcraft/rally';
7
- import { Agora } from '@productcraft/agora';
8
- export { Agora } from '@productcraft/agora';
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.envoi.client.POST(
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/heimdall` (and skip this umbrella).
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, heimdall: { baseUrl: "..." } })`.
51
+ * `new ProductCraft({ auth, overrides: { mail: { baseUrl: "..." } } })`.
40
52
  */
41
53
  declare class ProductCraft {
42
- readonly heimdall: Heimdall;
43
- readonly envoi: Envoi;
44
- readonly rally: Rally;
45
- readonly agora: Agora;
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
- heimdall?: PCClientConfig;
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 { Heimdall } from '@productcraft/heimdall';
2
- export { Heimdall } from '@productcraft/heimdall';
3
- import { Envoi } from '@productcraft/envoi';
4
- export { Envoi } from '@productcraft/envoi';
5
- import { Rally } from '@productcraft/rally';
6
- export { Rally } from '@productcraft/rally';
7
- import { Agora } from '@productcraft/agora';
8
- export { Agora } from '@productcraft/agora';
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
- heimdall;
16
- envoi;
17
- rally;
18
- agora;
15
+ auth;
16
+ mail;
17
+ waitlist;
18
+ social;
19
19
  platformAuth;
20
20
  constructor(config = {}) {
21
- const {
22
- heimdall: hOverride,
23
- envoi: eOverride,
24
- rally: rOverride,
25
- agora: aOverride,
26
- platformAuth: pOverride,
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":";;;;;;;;;;;;;AAqCO,IAAM,eAAN,MAAmB;AAAA,EACR,QAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA;AAAA,EAEhB,WAAA,CACE,MAAA,GAMI,EAAC,EACL;AACA,IAAA,MAAM;AAAA,MACJ,QAAA,EAAU,SAAA;AAAA,MACV,KAAA,EAAO,SAAA;AAAA,MACP,KAAA,EAAO,SAAA;AAAA,MACP,KAAA,EAAO,SAAA;AAAA,MACP,YAAA,EAAc,SAAA;AAAA,MACd,GAAG;AAAA,KACL,GAAI,MAAA;AACJ,IAAA,IAAA,CAAK,QAAA,GAAW,IAAI,QAAA,CAAS,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AACxD,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,KAAA,CAAM,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AAClD,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,KAAA,CAAM,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AAClD,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,KAAA,CAAM,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AAClD,IAAA,IAAA,CAAK,YAAA,GAAe,IAAI,YAAA,CAAa,EAAE,GAAG,MAAA,EAAQ,GAAG,WAAW,CAAA;AAAA,EAClE;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.envoi.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/heimdall` (and skip this umbrella).\n */\n\nimport { Heimdall } from \"@productcraft/heimdall\";\nimport { Envoi } from \"@productcraft/envoi\";\nimport { Rally } from \"@productcraft/rally\";\nimport { Agora } from \"@productcraft/agora\";\nimport { PlatformAuth } from \"@productcraft/platform-auth\";\nimport type { PCClientConfig } from \"@productcraft/core\";\n\nexport { Heimdall, Envoi, Rally, Agora, PlatformAuth };\nexport { PC_BASE_URL, type PCAuth, type PCClientConfig } from \"@productcraft/core\";\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, heimdall: { baseUrl: \"...\" } })`.\n */\nexport class ProductCraft {\n public readonly heimdall: Heimdall;\n public readonly envoi: Envoi;\n public readonly rally: Rally;\n public readonly agora: Agora;\n public readonly platformAuth: PlatformAuth;\n\n constructor(\n config: PCClientConfig & {\n heimdall?: PCClientConfig;\n envoi?: PCClientConfig;\n rally?: PCClientConfig;\n agora?: PCClientConfig;\n platformAuth?: PCClientConfig;\n } = {},\n ) {\n const {\n heimdall: hOverride,\n envoi: eOverride,\n rally: rOverride,\n agora: aOverride,\n platformAuth: pOverride,\n ...shared\n } = config;\n this.heimdall = new Heimdall({ ...shared, ...hOverride });\n this.envoi = new Envoi({ ...shared, ...eOverride });\n this.rally = new Rally({ ...shared, ...rOverride });\n this.agora = new Agora({ ...shared, ...aOverride });\n this.platformAuth = new PlatformAuth({ ...shared, ...pOverride });\n }\n}\n"]}
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.13",
4
- "description": "All-in-one Node.js / TypeScript SDK for the ProductCraft platform — Heimdall, Envoi, Rally, Agora, and Platform-Auth from a single import. Install per-product packages (`@productcraft/heimdall`, ...) if you only need one.",
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
- "heimdall",
28
- "envoi",
29
- "rally",
30
- "agora",
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/agora": "^0.0.10",
50
- "@productcraft/core": "^0.0.5",
51
- "@productcraft/envoi": "^0.0.8",
52
- "@productcraft/heimdall": "^0.4.0",
53
- "@productcraft/platform-auth": "^0.0.9",
54
- "@productcraft/rally": "^0.0.9"
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",