weave-typescript 0.48.0 → 0.49.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.
|
@@ -13,6 +13,18 @@ export interface CreateUserRow {
|
|
|
13
13
|
updatedAt: Date;
|
|
14
14
|
}
|
|
15
15
|
export declare function createUser(client: Client, args: CreateUserArgs): Promise<CreateUserRow | null>;
|
|
16
|
+
export declare const createUserWithIDQuery = "-- name: CreateUserWithID :one\nINSERT INTO weave.users (\n id,\n status\n) VALUES (\n $1,\n $2\n)\nON CONFLICT (id) DO NOTHING\nRETURNING id, status, created_at, updated_at";
|
|
17
|
+
export interface CreateUserWithIDArgs {
|
|
18
|
+
id: string;
|
|
19
|
+
status: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateUserWithIDRow {
|
|
22
|
+
id: string;
|
|
23
|
+
status: string;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
26
|
+
}
|
|
27
|
+
export declare function createUserWithID(client: Client, args: CreateUserWithIDArgs): Promise<CreateUserWithIDRow | null>;
|
|
16
28
|
export declare const getUserByIDQuery = "-- name: GetUserByID :one\nSELECT id, status, created_at, updated_at\nFROM weave.users\nWHERE id = $1";
|
|
17
29
|
export interface GetUserByIDArgs {
|
|
18
30
|
id: string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.deleteOrgTeamMembershipsForOrganizationMemberQuery = exports.listEffectiveOrganizationRoleIDsQuery = exports.listOrgTeamRoleGrantsQuery = exports.listOrgTeamMembersQuery = exports.addOrgTeamRoleGrantQuery = exports.deleteOrgTeamRoleGrantsQuery = exports.addOrgTeamMembershipQuery = exports.deleteOrgTeamMembershipsQuery = exports.deleteOrgTeamQuery = exports.updateOrgTeamQuery = void 0;
|
|
3
|
+
exports.getOrgTeamQuery = exports.createOrgTeamQuery = exports.deleteExpiredAuthInviteSessionsQuery = exports.revokeAuthInviteSessionsByMemberQuery = exports.markAuthInviteSessionRecoveryRequiredQuery = exports.markAuthInviteSessionCompletedQuery = exports.setAuthInviteSessionOAuthStateQuery = exports.getAuthInviteSessionQuery = exports.createAuthInviteSessionQuery = exports.deleteExpiredApplicationSessionsQuery = exports.markApplicationSessionOrganizationSessionStateQuery = exports.listApplicationSessionOrganizationSessionStatesQuery = exports.getApplicationSessionOrganizationSessionQuery = exports.upsertApplicationSessionOrganizationSessionQuery = exports.revokeApplicationSessionQuery = exports.setApplicationSessionActiveOrganizationQuery = exports.getApplicationSessionQuery = exports.createApplicationSessionQuery = exports.listAuthorizationDecisionEventsByOrganizationQuery = exports.insertAuthorizationDecisionEventQuery = exports.insertAuthAuditEventQuery = exports.endSupportAccessSessionQuery = exports.createSupportAccessSessionQuery = exports.createPlatformAdminGrantQuery = exports.listActivePlatformAdminGrantsForUserQuery = exports.getOrganizationMemberAdminRecordQuery = exports.listOrganizationMembersQuery = exports.listOrganizationMembershipsForUserQuery = exports.getOrganizationMembershipQuery = exports.upsertOrganizationMembershipQuery = exports.upsertOrganizationAuthLinkQuery = exports.getOrganizationAuthLinkByOrganizationIDQuery = exports.getOrganizationAuthLinkByStytchIDQuery = exports.upsertIdentityLinkQuery = exports.getIdentityLinkByStytchMemberQuery = exports.getUserProfileQuery = exports.upsertUserProfileQuery = exports.deleteOrganizationAuthDomainQuery = exports.listOrganizationAuthDomainsQuery = exports.upsertOrganizationAuthDomainQuery = exports.resolvePrimaryOrganizationAuthLinkByDomainQuery = exports.updateUserProfileThemeQuery = exports.setUserOrganizationPagePositionQuery = exports.setUserLastOrganizationQuery = exports.getUserAuthPreferencesQuery = exports.getUserPrimaryOrganizationAuthLinkQuery = exports.setUserPrimaryOrganizationQuery = exports.getUserByIDQuery = exports.createUserWithIDQuery = exports.createUserQuery = void 0;
|
|
4
|
+
exports.deleteOrgTeamMembershipsForOrganizationMemberQuery = exports.listEffectiveOrganizationRoleIDsQuery = exports.listOrgTeamRoleGrantsQuery = exports.listOrgTeamMembersQuery = exports.addOrgTeamRoleGrantQuery = exports.deleteOrgTeamRoleGrantsQuery = exports.addOrgTeamMembershipQuery = exports.deleteOrgTeamMembershipsQuery = exports.deleteOrgTeamQuery = exports.updateOrgTeamQuery = exports.listOrgTeamsQuery = void 0;
|
|
5
5
|
exports.createUser = createUser;
|
|
6
|
+
exports.createUserWithID = createUserWithID;
|
|
6
7
|
exports.getUserByID = getUserByID;
|
|
7
8
|
exports.setUserPrimaryOrganization = setUserPrimaryOrganization;
|
|
8
9
|
exports.getUserPrimaryOrganizationAuthLink = getUserPrimaryOrganizationAuthLink;
|
|
@@ -73,6 +74,33 @@ async function createUser(client, args) {
|
|
|
73
74
|
updatedAt: row[3]
|
|
74
75
|
};
|
|
75
76
|
}
|
|
77
|
+
exports.createUserWithIDQuery = `-- name: CreateUserWithID :one
|
|
78
|
+
INSERT INTO weave.users (
|
|
79
|
+
id,
|
|
80
|
+
status
|
|
81
|
+
) VALUES (
|
|
82
|
+
$1,
|
|
83
|
+
$2
|
|
84
|
+
)
|
|
85
|
+
ON CONFLICT (id) DO NOTHING
|
|
86
|
+
RETURNING id, status, created_at, updated_at`;
|
|
87
|
+
async function createUserWithID(client, args) {
|
|
88
|
+
const result = await client.query({
|
|
89
|
+
text: exports.createUserWithIDQuery,
|
|
90
|
+
values: [args.id, args.status],
|
|
91
|
+
rowMode: "array"
|
|
92
|
+
});
|
|
93
|
+
if (result.rows.length !== 1) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const row = result.rows[0];
|
|
97
|
+
return {
|
|
98
|
+
id: row[0],
|
|
99
|
+
status: row[1],
|
|
100
|
+
createdAt: row[2],
|
|
101
|
+
updatedAt: row[3]
|
|
102
|
+
};
|
|
103
|
+
}
|
|
76
104
|
exports.getUserByIDQuery = `-- name: GetUserByID :one
|
|
77
105
|
SELECT id, status, created_at, updated_at
|
|
78
106
|
FROM weave.users
|
|
@@ -26,6 +26,31 @@ export interface CreateOrganizationRow {
|
|
|
26
26
|
updatedAt: Date;
|
|
27
27
|
}
|
|
28
28
|
export declare function createOrganization(client: Client, args: CreateOrganizationArgs): Promise<CreateOrganizationRow | null>;
|
|
29
|
+
export declare const createOrganizationWithIDQuery = "-- name: CreateOrganizationWithID :one\nINSERT INTO weave.organizations (\n id,\n slug,\n name,\n description,\n primary_color,\n logo,\n logo_content_type,\n timezone,\n location\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9\n)\nON CONFLICT (slug) DO NOTHING\nRETURNING\n id,\n slug,\n name,\n description,\n primary_color,\n (logo IS NOT NULL) AS has_logo,\n timezone,\n location,\n created_at,\n updated_at";
|
|
30
|
+
export interface CreateOrganizationWithIDArgs {
|
|
31
|
+
id: string;
|
|
32
|
+
slug: string;
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
primaryColor: string;
|
|
36
|
+
logo: Buffer | null;
|
|
37
|
+
logoContentType: string | null;
|
|
38
|
+
timezone: string;
|
|
39
|
+
location: string;
|
|
40
|
+
}
|
|
41
|
+
export interface CreateOrganizationWithIDRow {
|
|
42
|
+
id: string;
|
|
43
|
+
slug: string;
|
|
44
|
+
name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
primaryColor: string;
|
|
47
|
+
hasLogo: string | null;
|
|
48
|
+
timezone: string;
|
|
49
|
+
location: string;
|
|
50
|
+
createdAt: Date;
|
|
51
|
+
updatedAt: Date;
|
|
52
|
+
}
|
|
53
|
+
export declare function createOrganizationWithID(client: Client, args: CreateOrganizationWithIDArgs): Promise<CreateOrganizationWithIDRow | null>;
|
|
29
54
|
export declare const getOrganizationBySlugQuery = "-- name: GetOrganizationBySlug :one\nSELECT\n id,\n slug,\n name,\n description,\n primary_color,\n (logo IS NOT NULL) AS has_logo,\n timezone,\n location,\n created_at,\n updated_at\nFROM weave.organizations\nWHERE slug = $1";
|
|
30
55
|
export interface GetOrganizationBySlugArgs {
|
|
31
56
|
slug: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clearOrganizationLogoQuery = exports.setOrganizationLogoQuery = exports.getOrganizationLogoQuery = exports.deleteOrganizationQuery = exports.updateOrganizationQuery = exports.listOrganizationsQuery = exports.getOrganizationByIDQuery = exports.getOrganizationBySlugQuery = exports.createOrganizationQuery = void 0;
|
|
3
|
+
exports.clearOrganizationLogoQuery = exports.setOrganizationLogoQuery = exports.getOrganizationLogoQuery = exports.deleteOrganizationQuery = exports.updateOrganizationQuery = exports.listOrganizationsQuery = exports.getOrganizationByIDQuery = exports.getOrganizationBySlugQuery = exports.createOrganizationWithIDQuery = exports.createOrganizationQuery = void 0;
|
|
4
4
|
exports.createOrganization = createOrganization;
|
|
5
|
+
exports.createOrganizationWithID = createOrganizationWithID;
|
|
5
6
|
exports.getOrganizationBySlug = getOrganizationBySlug;
|
|
6
7
|
exports.getOrganizationByID = getOrganizationByID;
|
|
7
8
|
exports.listOrganizations = listOrganizations;
|
|
@@ -62,6 +63,63 @@ async function createOrganization(client, args) {
|
|
|
62
63
|
updatedAt: row[9]
|
|
63
64
|
};
|
|
64
65
|
}
|
|
66
|
+
exports.createOrganizationWithIDQuery = `-- name: CreateOrganizationWithID :one
|
|
67
|
+
INSERT INTO weave.organizations (
|
|
68
|
+
id,
|
|
69
|
+
slug,
|
|
70
|
+
name,
|
|
71
|
+
description,
|
|
72
|
+
primary_color,
|
|
73
|
+
logo,
|
|
74
|
+
logo_content_type,
|
|
75
|
+
timezone,
|
|
76
|
+
location
|
|
77
|
+
) VALUES (
|
|
78
|
+
$1,
|
|
79
|
+
$2,
|
|
80
|
+
$3,
|
|
81
|
+
$4,
|
|
82
|
+
$5,
|
|
83
|
+
$6,
|
|
84
|
+
$7,
|
|
85
|
+
$8,
|
|
86
|
+
$9
|
|
87
|
+
)
|
|
88
|
+
ON CONFLICT (slug) DO NOTHING
|
|
89
|
+
RETURNING
|
|
90
|
+
id,
|
|
91
|
+
slug,
|
|
92
|
+
name,
|
|
93
|
+
description,
|
|
94
|
+
primary_color,
|
|
95
|
+
(logo IS NOT NULL) AS has_logo,
|
|
96
|
+
timezone,
|
|
97
|
+
location,
|
|
98
|
+
created_at,
|
|
99
|
+
updated_at`;
|
|
100
|
+
async function createOrganizationWithID(client, args) {
|
|
101
|
+
const result = await client.query({
|
|
102
|
+
text: exports.createOrganizationWithIDQuery,
|
|
103
|
+
values: [args.id, args.slug, args.name, args.description, args.primaryColor, args.logo, args.logoContentType, args.timezone, args.location],
|
|
104
|
+
rowMode: "array"
|
|
105
|
+
});
|
|
106
|
+
if (result.rows.length !== 1) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const row = result.rows[0];
|
|
110
|
+
return {
|
|
111
|
+
id: row[0],
|
|
112
|
+
slug: row[1],
|
|
113
|
+
name: row[2],
|
|
114
|
+
description: row[3],
|
|
115
|
+
primaryColor: row[4],
|
|
116
|
+
hasLogo: row[5],
|
|
117
|
+
timezone: row[6],
|
|
118
|
+
location: row[7],
|
|
119
|
+
createdAt: row[8],
|
|
120
|
+
updatedAt: row[9]
|
|
121
|
+
};
|
|
122
|
+
}
|
|
65
123
|
exports.getOrganizationBySlugQuery = `-- name: GetOrganizationBySlug :one
|
|
66
124
|
SELECT
|
|
67
125
|
id,
|