@stackframe/stack-shared 2.5.6 → 2.5.8

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,18 @@
1
1
  # @stackframe/stack-shared
2
2
 
3
+ ## 2.5.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Improved docs
8
+ - @stackframe/stack-sc@2.5.8
9
+
10
+ ## 2.5.7
11
+
12
+ ### Patch Changes
13
+
14
+ - @stackframe/stack-sc@2.5.7
15
+
3
16
  ## 2.5.6
4
17
 
5
18
  ### Patch Changes
package/dist/crud.d.ts CHANGED
@@ -11,6 +11,7 @@ declare module 'yup' {
11
11
  description?: string;
12
12
  exampleValue?: any;
13
13
  hidden?: boolean;
14
+ onlyShowInOperations?: Capitalize<CrudlOperation>[];
14
15
  };
15
16
  }
16
17
  }
@@ -18,6 +19,7 @@ type ShownEndpointDocumentation = {
18
19
  summary: string;
19
20
  description: string;
20
21
  tags?: string[];
22
+ crudOperation?: Capitalize<CrudlOperation>;
21
23
  };
22
24
  export type EndpointDocumentation = ({
23
25
  hidden: true;
@@ -8,7 +8,6 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
8
8
  id: string;
9
9
  account_id: string;
10
10
  }[];
11
- project_id: string;
12
11
  primary_email: string | null;
13
12
  profile_image_url: string | null;
14
13
  client_metadata: {} | null;
@@ -24,7 +23,6 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
24
23
  profile_image_url: string | null;
25
24
  } | null;
26
25
  }) | null, import("yup").AnyObject, {
27
- project_id: undefined;
28
26
  id: undefined;
29
27
  primary_email: undefined;
30
28
  primary_email_verified: undefined;
@@ -44,7 +42,6 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
44
42
  server_metadata: undefined;
45
43
  }, "">;
46
44
  serverReadSchema: import("yup").ObjectSchema<{
47
- project_id: string;
48
45
  id: string;
49
46
  primary_email: string | null;
50
47
  primary_email_verified: NonNullable<boolean | undefined>;
@@ -68,7 +65,6 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
68
65
  client_metadata: {} | null;
69
66
  server_metadata: {} | null;
70
67
  } | null, import("yup").AnyObject, {
71
- project_id: undefined;
72
68
  id: undefined;
73
69
  primary_email: undefined;
74
70
  primary_email_verified: undefined;
@@ -9,7 +9,6 @@ const clientUpdateSchema = usersCrudServerUpdateSchema.pick([
9
9
  ]).required();
10
10
  const serverUpdateSchema = usersCrudServerUpdateSchema;
11
11
  const clientReadSchema = usersCrudServerReadSchema.pick([
12
- "project_id",
13
12
  "id",
14
13
  "primary_email",
15
14
  "primary_email_verified",
@@ -15,13 +15,13 @@ export const teamPermissionsCrud = createCrud({
15
15
  serverDeleteSchema: teamPermissionsCrudServerDeleteSchema,
16
16
  docs: {
17
17
  clientList: {
18
- summary: "List team permissions of the current user",
19
- description: "user_id=me needs to be set",
18
+ summary: "List team permissions",
19
+ description: "List team permissions of the current user. `user_id=me` must be set for client requests. Note that this might contain the permissions with the same permission ID across different teams. `(team_id, user_id, permission_id)` together uniquely identify a permission.",
20
20
  tags: ["Permissions"],
21
21
  },
22
22
  serverList: {
23
23
  summary: "List team permissions of a user",
24
- description: "Query and filter the permission with team_id, user_id, and permission_id",
24
+ description: "Query and filter the permission with `team_id`, `user_id`, and `permission_id`. Note that this might contain the permissions with the same permission ID across different teams and users. `(team_id, user_id, permission_id)` together uniquely identify a permission.",
25
25
  tags: ["Permissions"],
26
26
  },
27
27
  serverCreate: {
@@ -38,12 +38,12 @@ export const teamsCrud = createCrud({
38
38
  docs: {
39
39
  clientList: {
40
40
  summary: "List teams",
41
- description: "List all the teams that the current user is a member of.",
41
+ description: "List all the teams that the current user is a member of. `user_id=me` must be passed in the query parameters.",
42
42
  tags: ["Teams"],
43
43
  },
44
44
  clientCreate: {
45
45
  summary: "Create a team",
46
- description: "Create a new team and add the current user as a member.",
46
+ description: "Create a new team and optionally add the current user as a member.",
47
47
  tags: ["Teams"],
48
48
  },
49
49
  clientRead: {
@@ -53,7 +53,7 @@ export const teamsCrud = createCrud({
53
53
  },
54
54
  serverCreate: {
55
55
  summary: "Create a team",
56
- description: "Create a new team and add the current user as a member.",
56
+ description: "Create a new team and optionally add the current user as a member.",
57
57
  tags: ["Teams"],
58
58
  },
59
59
  serverList: {
@@ -68,7 +68,7 @@ export const teamsCrud = createCrud({
68
68
  },
69
69
  serverUpdate: {
70
70
  summary: "Update a team",
71
- description: "Update a team by ID.",
71
+ description: "Update the team information by ID.",
72
72
  tags: ["Teams"],
73
73
  },
74
74
  serverDelete: {
@@ -21,7 +21,6 @@ export declare const usersCrudServerUpdateSchema: import("yup").ObjectSchema<{
21
21
  selected_team_id: undefined;
22
22
  }, "">;
23
23
  export declare const usersCrudServerReadSchema: import("yup").ObjectSchema<{
24
- project_id: string;
25
24
  id: string;
26
25
  primary_email: string | null;
27
26
  primary_email_verified: NonNullable<boolean | undefined>;
@@ -45,7 +44,6 @@ export declare const usersCrudServerReadSchema: import("yup").ObjectSchema<{
45
44
  client_metadata: {} | null;
46
45
  server_metadata: {} | null;
47
46
  }, import("yup").AnyObject, {
48
- project_id: undefined;
49
47
  id: undefined;
50
48
  primary_email: undefined;
51
49
  primary_email_verified: undefined;
@@ -96,7 +94,6 @@ export declare const usersCrudServerCreateSchema: import("yup").ObjectSchema<{
96
94
  export declare const usersCrudServerDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
97
95
  export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
98
96
  serverReadSchema: import("yup").ObjectSchema<{
99
- project_id: string;
100
97
  id: string;
101
98
  primary_email: string | null;
102
99
  primary_email_verified: NonNullable<boolean | undefined>;
@@ -120,7 +117,6 @@ export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
120
117
  client_metadata: {} | null;
121
118
  server_metadata: {} | null;
122
119
  }, import("yup").AnyObject, {
123
- project_id: undefined;
124
120
  id: undefined;
125
121
  primary_email: undefined;
126
122
  primary_email_verified: undefined;
@@ -13,7 +13,6 @@ export const usersCrudServerUpdateSchema = fieldSchema.yupObject({
13
13
  selected_team_id: fieldSchema.selectedTeamIdSchema.nullable().optional(),
14
14
  }).required();
15
15
  export const usersCrudServerReadSchema = fieldSchema.yupObject({
16
- project_id: fieldSchema.projectIdSchema.required(),
17
16
  id: fieldSchema.userIdSchema.required(),
18
17
  primary_email: fieldSchema.primaryEmailSchema.nullable().defined(),
19
18
  primary_email_verified: fieldSchema.primaryEmailVerifiedSchema.required(),
@@ -28,7 +27,7 @@ export const usersCrudServerReadSchema = fieldSchema.yupObject({
28
27
  id: fieldSchema.yupString().required(),
29
28
  account_id: fieldSchema.yupString().required(),
30
29
  email: fieldSchema.yupString().nullable(),
31
- }).required()).required().meta({ openapiField: { description: 'A list of OAuth providers connected to this account', exampleValue: ['google', 'github'] } }),
30
+ }).required()).required().meta({ openapiField: { description: 'A list of OAuth providers connected to this account', exampleValue: [{ id: 'google', account_id: '12345', email: 'john.doe@gmail.com' }] } }),
32
31
  client_metadata: fieldSchema.userClientMetadataSchema,
33
32
  server_metadata: fieldSchema.userServerMetadataSchema,
34
33
  }).required();
@@ -1,12 +1,13 @@
1
1
  import * as yup from "yup";
2
2
  import { isUuid } from "./utils/uuids";
3
- const _idDescription = (identify) => `The immutable ID used to uniquely identify this ${identify}`;
4
- const _displayNameDescription = (identify) => `Human-readable ${identify} display name, used in places like frontend UI. This is not a unique identifier.`;
3
+ const _idDescription = (identify) => `The unique identifier of this ${identify}`;
4
+ const _displayNameDescription = (identify) => `Human-readable ${identify} display name. This is not a unique identifier.`;
5
5
  const _clientMetaDataDescription = (identify) => `Client metadata. Used as a data store, accessible from the client side. Do not store information that should not be exposed to the client.`;
6
6
  const _serverMetaDataDescription = (identify) => `Server metadata. Used as a data store, only accessible from the server side. You can store secret information related to the ${identify} here.`;
7
7
  const _atMillisDescription = (identify) => `(the number of milliseconds since epoch, January 1, 1970, UTC)`;
8
8
  const _createdAtMillisDescription = (identify) => `The time the ${identify} was created ${_atMillisDescription(identify)}`;
9
9
  const _updatedAtMillisDescription = (identify) => `The time the ${identify} was last updated ${_atMillisDescription(identify)}`;
10
+ const _signedUpAtMillisDescription = `The time the user signed up ${_atMillisDescription}`;
10
11
  // Built-in replacements
11
12
  /* eslint-disable no-restricted-syntax */
12
13
  export function yupString(...args) {
@@ -143,8 +144,8 @@ export const primaryEmailSchema = emailSchema.meta({ openapiField: { description
143
144
  export const primaryEmailVerifiedSchema = yupBoolean().meta({ openapiField: { description: 'Whether the primary email has been verified to belong to this user', exampleValue: true } });
144
145
  export const userDisplayNameSchema = yupString().nullable().meta({ openapiField: { description: _displayNameDescription('user'), exampleValue: 'John Doe' } });
145
146
  export const selectedTeamIdSchema = yupString().meta({ openapiField: { description: 'ID of the team currently selected by the user', exampleValue: 'team-id' } });
146
- export const profileImageUrlSchema = yupString().meta({ openapiField: { description: 'Profile image URL', exampleValue: 'https://example.com/image.jpg' } });
147
- export const signedUpAtMillisSchema = yupNumber().meta({ openapiField: { description: 'Signed up at milliseconds', exampleValue: 1630000000000 } });
147
+ export const profileImageUrlSchema = yupString().meta({ openapiField: { description: 'Profile image URL. Can be a Base64 encoded image. Please compress and crop to a square before passing in.', exampleValue: 'https://example.com/image.jpg' } });
148
+ export const signedUpAtMillisSchema = yupNumber().meta({ openapiField: { description: _signedUpAtMillisDescription, exampleValue: 1630000000000 } });
148
149
  export const userClientMetadataSchema = jsonSchema.meta({ openapiField: { description: _clientMetaDataDescription('user'), exampleValue: { key: 'value' } } });
149
150
  export const userServerMetadataSchema = jsonSchema.meta({ openapiField: { description: _serverMetaDataDescription('user'), exampleValue: { key: 'value' } } });
150
151
  // Auth
@@ -177,7 +178,7 @@ export const teamPermissionDefinitionIdSchema = yupString()
177
178
  }
178
179
  return true;
179
180
  })
180
- .meta({ openapiField: { description: `The permission ID used to uniquely identify a permission. Can either be a custom permission with lowercase letters, numbers, ":", and "_" characters, or one of the system permissions: ${teamSystemPermissions.join(', ')}`, exampleValue: '$read_secret_info' } });
181
+ .meta({ openapiField: { description: `The permission ID used to uniquely identify a permission. Can either be a custom permission with lowercase letters, numbers, \`:\`, and \`_\` characters, or one of the system permissions: ${teamSystemPermissions.map(x => `\`${x}\``).join(', ')}`, exampleValue: 'read_secret_info' } });
181
182
  export const customTeamPermissionDefinitionIdSchema = yupString()
182
183
  .matches(/^[a-z0-9_:]+$/, 'Only lowercase letters, numbers, ":", "_" are allowed')
183
184
  .meta({ openapiField: { description: 'The permission ID used to uniquely identify a permission. Can only contain lowercase letters, numbers, ":", and "_" characters', exampleValue: 'read_secret_info' } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackframe/stack-shared",
3
- "version": "2.5.6",
3
+ "version": "2.5.8",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -36,7 +36,7 @@
36
36
  "jose": "^5.2.2",
37
37
  "oauth4webapi": "^2.10.3",
38
38
  "uuid": "^9.0.1",
39
- "@stackframe/stack-sc": "2.5.6"
39
+ "@stackframe/stack-sc": "2.5.8"
40
40
  },
41
41
  "devDependencies": {
42
42
  "rimraf": "^5.0.5",