@hexclave/shared 1.0.19 → 1.0.21

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 (75) hide show
  1. package/dist/ai/unified-prompts/reminders.js +1 -1
  2. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
  3. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +4 -5
  4. package/dist/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
  5. package/dist/config/schema-fuzzer.test.js +4 -1
  6. package/dist/config/schema-fuzzer.test.js.map +1 -1
  7. package/dist/config/schema.d.ts +190 -181
  8. package/dist/config/schema.d.ts.map +1 -1
  9. package/dist/config/schema.js +7 -3
  10. package/dist/config/schema.js.map +1 -1
  11. package/dist/esm/ai/unified-prompts/reminders.js +1 -1
  12. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.d.ts.map +1 -1
  13. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js +4 -5
  14. package/dist/esm/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.js.map +1 -1
  15. package/dist/esm/config/schema-fuzzer.test.js +4 -1
  16. package/dist/esm/config/schema-fuzzer.test.js.map +1 -1
  17. package/dist/esm/config/schema.d.ts +190 -181
  18. package/dist/esm/config/schema.d.ts.map +1 -1
  19. package/dist/esm/config/schema.js +8 -4
  20. package/dist/esm/config/schema.js.map +1 -1
  21. package/dist/esm/interface/admin-metrics.d.ts +10 -10
  22. package/dist/esm/interface/conversations.d.ts +9 -9
  23. package/dist/esm/interface/crud/current-user.d.ts +5 -5
  24. package/dist/esm/interface/crud/email-outbox.d.ts +116 -116
  25. package/dist/esm/interface/crud/products.d.ts +15 -15
  26. package/dist/esm/interface/crud/products.d.ts.map +1 -1
  27. package/dist/esm/interface/crud/project-api-keys.d.ts +2 -2
  28. package/dist/esm/interface/crud/team-member-profiles.d.ts +8 -8
  29. package/dist/esm/interface/crud/transactions.d.ts +21 -21
  30. package/dist/esm/interface/crud/transactions.d.ts.map +1 -1
  31. package/dist/esm/interface/crud/users.d.ts +4 -4
  32. package/dist/esm/interface/page-component-versions.d.ts.map +1 -1
  33. package/dist/esm/interface/page-component-versions.js +20 -4
  34. package/dist/esm/interface/page-component-versions.js.map +1 -1
  35. package/dist/esm/known-errors.d.ts +5 -5
  36. package/dist/esm/schema-fields.d.ts +8 -6
  37. package/dist/esm/schema-fields.d.ts.map +1 -1
  38. package/dist/esm/schema-fields.js +9 -1
  39. package/dist/esm/schema-fields.js.map +1 -1
  40. package/dist/esm/sessions.d.ts +7 -7
  41. package/dist/esm/utils/oauth.d.ts +8 -1
  42. package/dist/esm/utils/oauth.d.ts.map +1 -1
  43. package/dist/esm/utils/oauth.js +7 -1
  44. package/dist/esm/utils/oauth.js.map +1 -1
  45. package/dist/interface/admin-metrics.d.ts +10 -10
  46. package/dist/interface/conversations.d.ts +9 -9
  47. package/dist/interface/crud/current-user.d.ts +5 -5
  48. package/dist/interface/crud/email-outbox.d.ts +116 -116
  49. package/dist/interface/crud/products.d.ts +15 -15
  50. package/dist/interface/crud/products.d.ts.map +1 -1
  51. package/dist/interface/crud/project-api-keys.d.ts +2 -2
  52. package/dist/interface/crud/team-member-profiles.d.ts +8 -8
  53. package/dist/interface/crud/transactions.d.ts +21 -21
  54. package/dist/interface/crud/transactions.d.ts.map +1 -1
  55. package/dist/interface/crud/users.d.ts +4 -4
  56. package/dist/interface/page-component-versions.d.ts.map +1 -1
  57. package/dist/interface/page-component-versions.js +20 -4
  58. package/dist/interface/page-component-versions.js.map +1 -1
  59. package/dist/known-errors.d.ts +5 -5
  60. package/dist/schema-fields.d.ts +8 -6
  61. package/dist/schema-fields.d.ts.map +1 -1
  62. package/dist/schema-fields.js +10 -0
  63. package/dist/schema-fields.js.map +1 -1
  64. package/dist/sessions.d.ts +7 -7
  65. package/dist/utils/oauth.d.ts +8 -1
  66. package/dist/utils/oauth.d.ts.map +1 -1
  67. package/dist/utils/oauth.js +7 -0
  68. package/dist/utils/oauth.js.map +1 -1
  69. package/package.json +1 -1
  70. package/src/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.ts +4 -5
  71. package/src/config/schema-fuzzer.test.ts +3 -0
  72. package/src/config/schema.ts +9 -4
  73. package/src/interface/page-component-versions.ts +20 -4
  74. package/src/schema-fields.ts +2 -0
  75. package/src/utils/oauth.tsx +8 -0
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.js","names":[],"sources":["../../src/utils/oauth.tsx"],"sourcesContent":["export const standardProviders = [\"google\", \"github\", \"microsoft\", \"spotify\", \"facebook\", \"discord\", \"gitlab\", \"bitbucket\", \"linkedin\", \"apple\", \"x\", \"twitch\"] as const;\n// No more shared providers should be added except for special cases\nexport const sharedProviders = [\"google\", \"github\", \"microsoft\", \"spotify\"] as const;\nexport const allProviders = standardProviders;\nexport const publishableClientKeyNotNecessarySentinel = \"__stack_public_client__\";\n\nexport type ProviderType = typeof allProviders[number];\nexport type StandardProviderType = typeof standardProviders[number];\nexport type SharedProviderType = typeof sharedProviders[number];\n"],"mappings":";;;AAAA,MAAa,oBAAoB;CAAC;CAAU;CAAU;CAAa;CAAW;CAAY;CAAW;CAAU;CAAa;CAAY;CAAS;CAAK;CAAS;AAE/J,MAAa,kBAAkB;CAAC;CAAU;CAAU;CAAa;CAAU;AAC3E,MAAa,eAAe;AAC5B,MAAa,2CAA2C"}
1
+ {"version":3,"file":"oauth.js","names":[],"sources":["../../src/utils/oauth.tsx"],"sourcesContent":["export const standardProviders = [\"google\", \"github\", \"microsoft\", \"spotify\", \"facebook\", \"discord\", \"gitlab\", \"bitbucket\", \"linkedin\", \"apple\", \"x\", \"twitch\"] as const;\n// No more shared providers should be added except for special cases\nexport const sharedProviders = [\"google\", \"github\", \"microsoft\", \"spotify\"] as const;\nexport const allProviders = standardProviders;\nexport const publishableClientKeyNotNecessarySentinel = \"__stack_public_client__\";\n\n/**\n * All provider types including custom OIDC. Standard providers are the\n * predefined set with first-class support; \"custom_oidc\" lets users bring\n * any OIDC-compliant identity provider (team plan+ only).\n */\nexport const allProviderTypes = [...standardProviders, \"custom_oidc\"] as const;\nexport type AllProviderType = typeof allProviderTypes[number];\n\nexport type ProviderType = typeof allProviders[number];\nexport type StandardProviderType = typeof standardProviders[number];\nexport type SharedProviderType = typeof sharedProviders[number];\n"],"mappings":";;;AAAA,MAAa,oBAAoB;CAAC;CAAU;CAAU;CAAa;CAAW;CAAY;CAAW;CAAU;CAAa;CAAY;CAAS;CAAK;CAAS;AAE/J,MAAa,kBAAkB;CAAC;CAAU;CAAU;CAAa;CAAU;AAC3E,MAAa,eAAe;AAC5B,MAAa,2CAA2C;;;;;;AAOxD,MAAa,mBAAmB,CAAC,GAAG,mBAAmB,cAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexclave/shared",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "repository": "https://github.com/hexclave/hexclave",
5
5
  "files": [
6
6
  "README.md",
@@ -216,7 +216,6 @@ export const supabaseSetupPrompt = deindent`
216
216
 
217
217
  import { createSupabaseClient } from "@/utils/supabase-client";
218
218
  import { useHexclaveApp, useUser } from "@hexclave/next";
219
- import Link from "next/link";
220
219
  import { useEffect, useState } from "react";
221
220
 
222
221
  export default function Page() {
@@ -241,10 +240,10 @@ export const supabaseSetupPrompt = deindent`
241
240
  <>
242
241
  <p>You are signed in</p>
243
242
  <p>User ID: {user.id}</p>
244
- <Link href={app.urls.signOut}>Sign Out</Link>
243
+ <button onClick={async () => await app.redirectToSignOut()}>Sign Out</button>
245
244
  </>
246
245
  ) : (
247
- <Link href={app.urls.signIn}>Sign In</Link>
246
+ <button onClick={async () => await app.redirectToSignIn()}>Sign In</button>
248
247
  )}
249
248
  <h3>Supabase data</h3>
250
249
  <ul>{listContent}</ul>
@@ -978,8 +977,8 @@ export function getSdkSetupPrompt(mainType: "ai-prompt" | "nextjs" | "react" | "
978
977
  // ...
979
978
  "scripts": {
980
979
  // ...
981
- "dev": "hexclave dev --config-file ./hexclave.config.ts -- npm run dev:without-hexclave",
982
- "dev:without-hexclave": "<your-existing-dev-script>"
980
+ "dev": "hexclave dev --config-file ./hexclave.config.ts -- npm run dev:inner",
981
+ "dev:inner": "<your-existing-dev-script>"
983
982
  }
984
983
  }
985
984
  \`\`\`
@@ -216,6 +216,9 @@ const environmentSchemaFuzzerConfig = [{
216
216
  facebookConfigId: ["some-facebook-config-id"],
217
217
  microsoftTenantId: ["some-microsoft-tenant-id"],
218
218
  appleBundles: [{ "some-bundle-id": [{ bundleId: ["com.example.app"] }] }],
219
+ issuerUrl: [undefined, "https://accounts.google.com"] as (string | undefined)[],
220
+ scope: [undefined, "openid email profile"] as (string | undefined)[],
221
+ displayName: [undefined, "My OIDC Provider"] as (string | undefined)[],
219
222
  }]]))] as const,
220
223
  }],
221
224
  }],
@@ -11,7 +11,7 @@ import * as schemaFields from "../schema-fields";
11
11
  import { productSchema, userSpecifiedIdSchema, yupBoolean, yupDate, yupMixed, yupNever, yupNumber, yupObject, yupRecord, yupString, yupTuple, yupUnion } from "../schema-fields";
12
12
  import { SUPPORTED_CURRENCIES } from "../utils/currency-constants";
13
13
  import { HexclaveAssertionError } from "../utils/errors";
14
- import { allProviders } from "../utils/oauth";
14
+ import { allProviders, allProviderTypes } from "../utils/oauth";
15
15
  import { DeepFilterUndefined, DeepMerge, DeepRequiredOrUndefined, filterUndefined, get, getOrUndefined, has, isObjectLike, mapValues, set, typedAssign, typedEntries, typedFromEntries } from "../utils/objects";
16
16
  import { Result } from "../utils/results";
17
17
  import { stringCompare } from "../utils/strings";
@@ -23,6 +23,7 @@ export const configLevels = ['project', 'branch', 'environment', 'organization']
23
23
  export type ConfigLevel = typeof configLevels[number];
24
24
  const permissionRegex = /^\$?[a-z0-9_:]+$/;
25
25
  const customPermissionRegex = /^[a-z0-9_:]+$/;
26
+ const providerIdRegex = /^[a-z0-9_-]+$/;
26
27
 
27
28
  declare module "yup" {
28
29
  // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
@@ -116,7 +117,7 @@ const branchAuthSchema = yupObject({
116
117
  providers: yupRecord(
117
118
  yupString().matches(permissionRegex),
118
119
  yupObject({
119
- type: yupString().oneOf(allProviders).optional(),
120
+ type: yupString().oneOf(allProviderTypes).optional(),
120
121
  allowSignIn: yupBoolean(),
121
122
  allowConnectedAccounts: yupBoolean(),
122
123
  }),
@@ -376,9 +377,9 @@ export const environmentConfigSchema = branchConfigSchema.concat(yupObject({
376
377
  auth: branchConfigSchema.getNested("auth").concat(yupObject({
377
378
  oauth: branchConfigSchema.getNested("auth").getNested("oauth").concat(yupObject({
378
379
  providers: yupRecord(
379
- yupString().matches(permissionRegex),
380
+ yupString().matches(providerIdRegex),
380
381
  yupObject({
381
- type: yupString().oneOf(allProviders).optional(),
382
+ type: yupString().oneOf(allProviderTypes).optional(),
382
383
  isShared: yupBoolean(),
383
384
  clientId: schemaFields.oauthClientIdSchema.optional(),
384
385
  clientSecret: schemaFields.oauthClientSecretSchema.optional(),
@@ -395,6 +396,10 @@ export const environmentConfigSchema = branchConfigSchema.concat(yupObject({
395
396
  bundleId: schemaFields.oauthAppleBundleIdSchema,
396
397
  }),
397
398
  ).optional(),
399
+ // Custom OIDC provider fields (only used when type is "custom_oidc")
400
+ issuerUrl: schemaFields.oauthIssuerUrlSchema.optional(),
401
+ scope: schemaFields.oauthScopeSchema.optional(),
402
+ displayName: yupString().optional(),
398
403
  allowSignIn: yupBoolean().optional(),
399
404
  allowConnectedAccounts: yupBoolean().optional(),
400
405
  }),
@@ -218,7 +218,7 @@ function createAuthPagePrompt(type: AuthPagePromptType): CustomPagePrompt {
218
218
  <Typography>
219
219
  {"Don't have an account? "}
220
220
  <a
221
- href={hexclaveApp.urls.signUp}
221
+ href="#"
222
222
  onClick={async (e) => {
223
223
  e.preventDefault();
224
224
  await hexclaveApp.redirectToSignUp();
@@ -231,7 +231,7 @@ function createAuthPagePrompt(type: AuthPagePromptType): CustomPagePrompt {
231
231
  }` : `<Typography>
232
232
  {"Already have an account? "}
233
233
  <a
234
- href={hexclaveApp.urls.signIn}
234
+ href="#"
235
235
  onClick={async (e) => {
236
236
  e.preventDefault();
237
237
  await hexclaveApp.redirectToSignIn();
@@ -552,7 +552,15 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
552
552
  <Typography type="h2">Reset Your Password</Typography>
553
553
  <Typography>
554
554
  {"Don't need to reset? "}
555
- <a href={hexclaveApp.urls.signIn}>Sign in</a>
555
+ <a
556
+ href="#"
557
+ onClick={async (e) => {
558
+ e.preventDefault();
559
+ await hexclaveApp.redirectToSignIn();
560
+ }}
561
+ >
562
+ Sign in
563
+ </a>
556
564
  </Typography>
557
565
 
558
566
  <form onSubmit={async (e) => {
@@ -618,7 +626,15 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
618
626
  {showRedirectLink ? (
619
627
  <Typography>
620
628
  {"If you are not redirected automatically, "}
621
- <a href={hexclaveApp.urls.home}>click here</a>
629
+ <a
630
+ href="#"
631
+ onClick={async (e) => {
632
+ e.preventDefault();
633
+ await hexclaveApp.redirectToHome();
634
+ }}
635
+ >
636
+ click here
637
+ </a>
622
638
  </Typography>
623
639
  ) : null}
624
640
  {error ? <pre>{JSON.stringify(error, null, 2)}</pre> : null}
@@ -605,6 +605,8 @@ export const oauthMicrosoftTenantIdSchema = yupString().meta({ openapiField: { d
605
605
  export const oauthAppleBundleIdsSchema = yupArray(yupString().defined()).meta({ openapiField: { description: 'Apple Bundle IDs for native iOS/macOS apps. Required for native Sign In with Apple (in addition to web Apple OAuth which uses the Client ID/Services ID).', exampleValue: ['com.example.ios', 'com.example.macos'] } });
606
606
  export const oauthAppleBundleIdSchema = yupString().defined().meta({ openapiField: { description: 'Apple Bundle ID for native iOS/macOS apps.', exampleValue: 'com.example.ios' } });
607
607
  export const oauthAccountMergeStrategySchema = yupString().oneOf(['link_method', 'raise_error', 'allow_duplicates']).meta({ openapiField: { description: 'Determines how to handle OAuth logins that match an existing user by email. `link_method` adds the OAuth method to the existing user. `raise_error` rejects the login with an error. `allow_duplicates` creates a new user.', exampleValue: 'link_method' } });
608
+ export const oauthIssuerUrlSchema = urlSchema.meta({ openapiField: { description: 'OIDC issuer URL for custom OIDC providers. Must support OIDC discovery (/.well-known/openid-configuration). Only used when type is "custom_oidc".', exampleValue: 'https://accounts.google.com' } });
609
+ export const oauthScopeSchema = yupString().meta({ openapiField: { description: 'Space-separated OAuth scopes to request from the custom OIDC provider. Defaults to "openid email profile" if not specified.', exampleValue: 'openid email profile' } });
608
610
  // Project email config
609
611
  export const emailTypeSchema = yupString().oneOf(['shared', 'standard']).meta({ openapiField: { description: 'Email provider type, one of shared, standard. "shared" uses Stack shared email provider and it is only meant for development. "standard" uses your own email server and will have your email address as the sender.', exampleValue: 'standard' } });
610
612
  export const emailSenderNameSchema = yupString().meta({ openapiField: { description: 'Email sender name. Needs to be specified when using type="standard"', exampleValue: 'Stack' } });
@@ -4,6 +4,14 @@ export const sharedProviders = ["google", "github", "microsoft", "spotify"] as c
4
4
  export const allProviders = standardProviders;
5
5
  export const publishableClientKeyNotNecessarySentinel = "__stack_public_client__";
6
6
 
7
+ /**
8
+ * All provider types including custom OIDC. Standard providers are the
9
+ * predefined set with first-class support; "custom_oidc" lets users bring
10
+ * any OIDC-compliant identity provider (team plan+ only).
11
+ */
12
+ export const allProviderTypes = [...standardProviders, "custom_oidc"] as const;
13
+ export type AllProviderType = typeof allProviderTypes[number];
14
+
7
15
  export type ProviderType = typeof allProviders[number];
8
16
  export type StandardProviderType = typeof standardProviders[number];
9
17
  export type SharedProviderType = typeof sharedProviders[number];