@stackframe/stack-shared 2.7.16 → 2.7.17

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @stackframe/stack-shared
2
2
 
3
+ ## 2.7.17
4
+
5
+ ### Patch Changes
6
+
7
+ - Various changes
8
+ - @stackframe/stack-sc@2.7.17
9
+
3
10
  ## 2.7.16
4
11
 
5
12
  ### Patch Changes
@@ -283,7 +283,7 @@ export class StackClientInterface {
283
283
  const errorObj = new StackAssertionError(`Failed to send request to ${url}: ${res.status} ${error}`, { request: params, res, path });
284
284
  if (res.status === 508 && error.includes("INFINITE_LOOP_DETECTED")) {
285
285
  // Some Vercel deployments seem to have an odd infinite loop bug. In that case, retry.
286
- // See: https://github.com/stack-auth/stack/issues/319
286
+ // See: https://github.com/stack-auth/stack-auth/issues/319
287
287
  return Result.error(errorObj);
288
288
  }
289
289
  // Do not retry, throw error instead of returning one
@@ -39,27 +39,27 @@ export const contactChannelsCrud = createCrud({
39
39
  docs: {
40
40
  clientRead: {
41
41
  summary: "Get a contact channel",
42
- description: "",
42
+ description: "Retrieves a specific contact channel by the user ID and the contact channel ID.",
43
43
  tags: ["Contact Channels"],
44
44
  },
45
45
  clientCreate: {
46
46
  summary: "Create a contact channel",
47
- description: "",
47
+ description: "Add a new contact channel for a user.",
48
48
  tags: ["Contact Channels"],
49
49
  },
50
50
  clientUpdate: {
51
51
  summary: "Update a contact channel",
52
- description: "",
52
+ description: "Updates an existing contact channel. Only the values provided will be updated.",
53
53
  tags: ["Contact Channels"],
54
54
  },
55
55
  clientDelete: {
56
56
  summary: "Delete a contact channel",
57
- description: "",
57
+ description: "Removes a contact channel for a given user.",
58
58
  tags: ["Contact Channels"],
59
59
  },
60
60
  clientList: {
61
61
  summary: "List contact channels",
62
- description: "",
62
+ description: "Retrieves a list of all contact channels for a user.",
63
63
  tags: ["Contact Channels"],
64
64
  }
65
65
  }
@@ -59,7 +59,7 @@ export declare const teamsCrudClientCreateSchema: import("yup").ObjectSchema<{
59
59
  client_metadata: {} | null | undefined;
60
60
  } & {
61
61
  display_name: string;
62
- creator_user_id: string;
62
+ creator_user_id: string | undefined;
63
63
  }, import("yup").AnyObject, {
64
64
  display_name: undefined;
65
65
  profile_image_url: undefined;
@@ -114,7 +114,7 @@ export declare const teamsCrud: import("../../crud").CrudSchemaFromOptions<{
114
114
  client_metadata: {} | null | undefined;
115
115
  } & {
116
116
  display_name: string;
117
- creator_user_id: string;
117
+ creator_user_id: string | undefined;
118
118
  }, import("yup").AnyObject, {
119
119
  display_name: undefined;
120
120
  profile_image_url: undefined;
@@ -26,7 +26,7 @@ export const teamsCrudServerUpdateSchema = teamsCrudClientUpdateSchema.concat(yu
26
26
  // Create
27
27
  export const teamsCrudClientCreateSchema = teamsCrudClientUpdateSchema.concat(yupObject({
28
28
  display_name: fieldSchema.teamDisplayNameSchema.defined(),
29
- creator_user_id: fieldSchema.teamCreatorUserIdSchema.defined(),
29
+ creator_user_id: fieldSchema.teamCreatorUserIdSchema.optional(),
30
30
  }).defined());
31
31
  export const teamsCrudServerCreateSchema = teamsCrudServerUpdateSchema.concat(yupObject({
32
32
  display_name: fieldSchema.teamDisplayNameSchema.defined(),
@@ -5,27 +5,3 @@ export declare function isBrowserLike(): boolean;
5
5
  export declare function getEnvVariable(name: string, defaultValue?: string | undefined): string;
6
6
  export declare function getNextRuntime(): string;
7
7
  export declare function getNodeEnvironment(): string;
8
- declare const _inlineEnvVars: {
9
- readonly NEXT_PUBLIC_STACK_API_URL: {
10
- readonly default: string | undefined;
11
- readonly client: string | undefined;
12
- readonly server: string | undefined;
13
- };
14
- readonly NEXT_PUBLIC_STACK_DASHBOARD_URL: {
15
- readonly default: string | undefined;
16
- readonly client: string | undefined;
17
- readonly server: string | undefined;
18
- };
19
- readonly NEXT_PUBLIC_POSTHOG_KEY: string | undefined;
20
- readonly NEXT_PUBLIC_STACK_SVIX_SERVER_URL: string | undefined;
21
- readonly NEXT_PUBLIC_SENTRY_DSN: string | undefined;
22
- readonly NEXT_PUBLIC_VERSION_ALERTER_SEVERE_ONLY: string | undefined;
23
- readonly NEXT_PUBLIC_STACK_EMULATOR_ENABLED: string | undefined;
24
- readonly NEXT_PUBLIC_STACK_EMULATOR_PROJECT_ID: string | undefined;
25
- readonly NEXT_PUBLIC_STACK_PROJECT_ID: string | undefined;
26
- readonly NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY: string | undefined;
27
- readonly NEXT_PUBLIC_STACK_URL: string | undefined;
28
- readonly NEXT_PUBLIC_STACK_INBUCKET_WEB_URL: string | undefined;
29
- };
30
- export declare function getPublicEnvVar(name: keyof typeof _inlineEnvVars): string | undefined;
31
- export {};
package/dist/utils/env.js CHANGED
@@ -57,82 +57,3 @@ export function getNextRuntime() {
57
57
  export function getNodeEnvironment() {
58
58
  return getEnvVariable("NODE_ENV", "");
59
59
  }
60
- // ===================== Hack to use dynamic env vars in docker build =====================
61
- const _inlineEnvVars = {
62
- NEXT_PUBLIC_STACK_API_URL: {
63
- 'default': process.env.NEXT_PUBLIC_STACK_API_URL,
64
- 'client': process.env.NEXT_PUBLIC_CLIENT_STACK_API_URL,
65
- 'server': process.env.NEXT_PUBLIC_SERVER_STACK_API_URL,
66
- },
67
- NEXT_PUBLIC_STACK_DASHBOARD_URL: {
68
- 'default': process.env.NEXT_PUBLIC_STACK_DASHBOARD_URL,
69
- 'client': process.env.NEXT_PUBLIC_CLIENT_STACK_DASHBOARD_URL,
70
- 'server': process.env.NEXT_PUBLIC_SERVER_STACK_DASHBOARD_URL,
71
- },
72
- NEXT_PUBLIC_POSTHOG_KEY: process.env.NEXT_PUBLIC_POSTHOG_KEY,
73
- NEXT_PUBLIC_STACK_SVIX_SERVER_URL: process.env.NEXT_PUBLIC_STACK_SVIX_SERVER_URL,
74
- NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
75
- NEXT_PUBLIC_VERSION_ALERTER_SEVERE_ONLY: process.env.NEXT_PUBLIC_VERSION_ALERTER_SEVERE_ONLY,
76
- NEXT_PUBLIC_STACK_EMULATOR_ENABLED: process.env.NEXT_PUBLIC_STACK_EMULATOR_ENABLED,
77
- NEXT_PUBLIC_STACK_EMULATOR_PROJECT_ID: process.env.NEXT_PUBLIC_STACK_EMULATOR_PROJECT_ID,
78
- NEXT_PUBLIC_STACK_PROJECT_ID: process.env.NEXT_PUBLIC_STACK_PROJECT_ID,
79
- NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY: process.env.NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY,
80
- NEXT_PUBLIC_STACK_URL: process.env.NEXT_PUBLIC_STACK_URL,
81
- NEXT_PUBLIC_STACK_INBUCKET_WEB_URL: process.env.NEXT_PUBLIC_STACK_INBUCKET_WEB_URL,
82
- };
83
- // This will be replaced with the actual env vars after a docker build
84
- const _postBuildEnvVars = {
85
- NEXT_PUBLIC_STACK_API_URL: {
86
- 'default': 'STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_STACK_API_URL',
87
- 'client': 'STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_CLIENT_STACK_API_URL',
88
- 'server': 'STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_SERVER_STACK_API_URL',
89
- },
90
- NEXT_PUBLIC_STACK_DASHBOARD_URL: {
91
- 'default': 'STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_STACK_DASHBOARD_URL',
92
- 'client': 'STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_CLIENT_STACK_DASHBOARD_URL',
93
- 'server': 'STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_SERVER_STACK_DASHBOARD_URL',
94
- },
95
- NEXT_PUBLIC_STACK_PROJECT_ID: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_STACK_PROJECT_ID",
96
- NEXT_PUBLIC_POSTHOG_KEY: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_POSTHOG_KEY",
97
- NEXT_PUBLIC_STACK_SVIX_SERVER_URL: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_STACK_SVIX_SERVER_URL",
98
- NEXT_PUBLIC_SENTRY_DSN: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_SENTRY_DSN",
99
- NEXT_PUBLIC_VERSION_ALERTER_SEVERE_ONLY: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_VERSION_ALERTER_SEVERE_ONLY",
100
- NEXT_PUBLIC_STACK_EMULATOR_ENABLED: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_STACK_EMULATOR_ENABLED",
101
- NEXT_PUBLIC_STACK_EMULATOR_PROJECT_ID: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_STACK_EMULATOR_PROJECT_ID",
102
- NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY",
103
- NEXT_PUBLIC_STACK_URL: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_STACK_URL",
104
- NEXT_PUBLIC_STACK_INBUCKET_WEB_URL: "STACK_ENV_VAR_SENTINEL_NEXT_PUBLIC_STACK_INBUCKET_WEB_URL",
105
- };
106
- // If this is not replaced with "true", then we will not use inline env vars
107
- const _usePostBuildEnvVars = 'STACK_ENV_VAR_SENTINEL_USE_INLINE_ENV_VARS';
108
- export function getPublicEnvVar(name) {
109
- // This is a hack to force the compiler not to do any smart optimizations
110
- const _ = _usePostBuildEnvVars.toString() + _inlineEnvVars.toString(); // Force runtime evaluation
111
- const value = _usePostBuildEnvVars.slice(0) === 'true' ? _postBuildEnvVars[name] : _inlineEnvVars[name];
112
- // Helper function to check if a value is a sentinel
113
- const isSentinel = (str) => {
114
- return _usePostBuildEnvVars.slice(0) === 'true' && str && str.startsWith('STACK_ENV_VAR_SENTINEL');
115
- };
116
- // If it's a dictionary with client/server values
117
- if (typeof value === 'object') {
118
- const preferredValue = isBrowserLike() ? value.client : value.server;
119
- // Check for sentinel values
120
- if (isSentinel(preferredValue)) {
121
- return isSentinel(value.default) ? undefined : value.default;
122
- }
123
- if (isSentinel(value.default)) {
124
- return undefined;
125
- }
126
- return preferredValue || value.default;
127
- }
128
- else if (typeof value === 'string') {
129
- if (isSentinel(value)) {
130
- return undefined;
131
- }
132
- return value;
133
- }
134
- else {
135
- return undefined;
136
- }
137
- }
138
- // ======================================================================
@@ -2,3 +2,4 @@ export declare function list(path: string): Promise<string[]>;
2
2
  export declare function listRecursively(p: string, options?: {
3
3
  excludeDirectories?: boolean;
4
4
  }): Promise<string[]>;
5
+ export declare function writeFileSyncIfChanged(path: string, content: string): void;
package/dist/utils/fs.js CHANGED
@@ -20,3 +20,12 @@ export async function listRecursively(p, options = {}) {
20
20
  }))).flat(),
21
21
  ];
22
22
  }
23
+ export function writeFileSyncIfChanged(path, content) {
24
+ if (stackFs.existsSync(path)) {
25
+ const existingContent = stackFs.readFileSync(path, "utf-8");
26
+ if (existingContent === content) {
27
+ return;
28
+ }
29
+ }
30
+ stackFs.writeFileSync(path, content);
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackframe/stack-shared",
3
- "version": "2.7.16",
3
+ "version": "2.7.17",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
@@ -52,7 +52,7 @@
52
52
  "oauth4webapi": "^2.10.3",
53
53
  "semver": "^7.6.3",
54
54
  "uuid": "^9.0.1",
55
- "@stackframe/stack-sc": "2.7.16"
55
+ "@stackframe/stack-sc": "2.7.17"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@sentry/nextjs": "^8.40.0",