@crowdedkingdoms/crowdyjs 1.0.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.
Files changed (124) hide show
  1. package/LICENSE +21 -0
  2. package/MIGRATION.md +247 -0
  3. package/README.md +303 -0
  4. package/dist/auth-state.d.ts +11 -0
  5. package/dist/auth-state.d.ts.map +1 -0
  6. package/dist/auth-state.js +13 -0
  7. package/dist/client.d.ts +135 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +150 -0
  10. package/dist/crowdy-client.d.ts +182 -0
  11. package/dist/crowdy-client.d.ts.map +1 -0
  12. package/dist/crowdy-client.js +146 -0
  13. package/dist/domains/actors.d.ts +117 -0
  14. package/dist/domains/actors.d.ts.map +1 -0
  15. package/dist/domains/actors.js +140 -0
  16. package/dist/domains/admin.d.ts +61 -0
  17. package/dist/domains/admin.d.ts.map +1 -0
  18. package/dist/domains/admin.js +33 -0
  19. package/dist/domains/appAccess.d.ts +141 -0
  20. package/dist/domains/appAccess.d.ts.map +1 -0
  21. package/dist/domains/appAccess.js +198 -0
  22. package/dist/domains/apps.d.ts +192 -0
  23. package/dist/domains/apps.d.ts.map +1 -0
  24. package/dist/domains/apps.js +217 -0
  25. package/dist/domains/auth.d.ts +163 -0
  26. package/dist/domains/auth.d.ts.map +1 -0
  27. package/dist/domains/auth.js +208 -0
  28. package/dist/domains/avatars.d.ts +94 -0
  29. package/dist/domains/avatars.d.ts.map +1 -0
  30. package/dist/domains/avatars.js +137 -0
  31. package/dist/domains/billing.d.ts +97 -0
  32. package/dist/domains/billing.d.ts.map +1 -0
  33. package/dist/domains/billing.js +131 -0
  34. package/dist/domains/channels.d.ts +293 -0
  35. package/dist/domains/channels.d.ts.map +1 -0
  36. package/dist/domains/channels.js +353 -0
  37. package/dist/domains/chunks.d.ts +133 -0
  38. package/dist/domains/chunks.d.ts.map +1 -0
  39. package/dist/domains/chunks.js +153 -0
  40. package/dist/domains/controlPlane.d.ts +174 -0
  41. package/dist/domains/controlPlane.d.ts.map +1 -0
  42. package/dist/domains/controlPlane.js +252 -0
  43. package/dist/domains/environments.d.ts +155 -0
  44. package/dist/domains/environments.d.ts.map +1 -0
  45. package/dist/domains/environments.js +223 -0
  46. package/dist/domains/gameApps.d.ts +114 -0
  47. package/dist/domains/gameApps.d.ts.map +1 -0
  48. package/dist/domains/gameApps.js +169 -0
  49. package/dist/domains/gameModel.d.ts +668 -0
  50. package/dist/domains/gameModel.d.ts.map +1 -0
  51. package/dist/domains/gameModel.js +816 -0
  52. package/dist/domains/host.d.ts +35 -0
  53. package/dist/domains/host.d.ts.map +1 -0
  54. package/dist/domains/host.js +40 -0
  55. package/dist/domains/organizations.d.ts +179 -0
  56. package/dist/domains/organizations.d.ts.map +1 -0
  57. package/dist/domains/organizations.js +269 -0
  58. package/dist/domains/payments.d.ts +104 -0
  59. package/dist/domains/payments.d.ts.map +1 -0
  60. package/dist/domains/payments.js +129 -0
  61. package/dist/domains/platform.d.ts +49 -0
  62. package/dist/domains/platform.d.ts.map +1 -0
  63. package/dist/domains/platform.js +50 -0
  64. package/dist/domains/quotas.d.ts +62 -0
  65. package/dist/domains/quotas.d.ts.map +1 -0
  66. package/dist/domains/quotas.js +79 -0
  67. package/dist/domains/serverStatus.d.ts +90 -0
  68. package/dist/domains/serverStatus.d.ts.map +1 -0
  69. package/dist/domains/serverStatus.js +104 -0
  70. package/dist/domains/sharedEnvironment.d.ts +133 -0
  71. package/dist/domains/sharedEnvironment.d.ts.map +1 -0
  72. package/dist/domains/sharedEnvironment.js +179 -0
  73. package/dist/domains/state.d.ts +64 -0
  74. package/dist/domains/state.d.ts.map +1 -0
  75. package/dist/domains/state.js +75 -0
  76. package/dist/domains/teams.d.ts +292 -0
  77. package/dist/domains/teams.d.ts.map +1 -0
  78. package/dist/domains/teams.js +352 -0
  79. package/dist/domains/teleport.d.ts +41 -0
  80. package/dist/domains/teleport.d.ts.map +1 -0
  81. package/dist/domains/teleport.js +43 -0
  82. package/dist/domains/udp.d.ts +405 -0
  83. package/dist/domains/udp.d.ts.map +1 -0
  84. package/dist/domains/udp.js +457 -0
  85. package/dist/domains/usage.d.ts +76 -0
  86. package/dist/domains/usage.d.ts.map +1 -0
  87. package/dist/domains/usage.js +110 -0
  88. package/dist/domains/users.d.ts +147 -0
  89. package/dist/domains/users.d.ts.map +1 -0
  90. package/dist/domains/users.js +195 -0
  91. package/dist/domains/voxels.d.ts +136 -0
  92. package/dist/domains/voxels.d.ts.map +1 -0
  93. package/dist/domains/voxels.js +153 -0
  94. package/dist/errors.d.ts +158 -0
  95. package/dist/errors.d.ts.map +1 -0
  96. package/dist/errors.js +142 -0
  97. package/dist/generated/graphql.d.ts +12206 -0
  98. package/dist/generated/graphql.d.ts.map +1 -0
  99. package/dist/generated/graphql.js +474 -0
  100. package/dist/index.d.ts +84 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +85 -0
  103. package/dist/logger.d.ts +8 -0
  104. package/dist/logger.d.ts.map +1 -0
  105. package/dist/logger.js +1 -0
  106. package/dist/realtime.d.ts +319 -0
  107. package/dist/realtime.d.ts.map +1 -0
  108. package/dist/realtime.js +390 -0
  109. package/dist/session.d.ts +73 -0
  110. package/dist/session.d.ts.map +1 -0
  111. package/dist/session.js +96 -0
  112. package/dist/subscriptions.d.ts +2 -0
  113. package/dist/subscriptions.d.ts.map +1 -0
  114. package/dist/subscriptions.js +1 -0
  115. package/dist/types.d.ts +658 -0
  116. package/dist/types.d.ts.map +1 -0
  117. package/dist/types.js +61 -0
  118. package/dist/utils.d.ts +98 -0
  119. package/dist/utils.d.ts.map +1 -0
  120. package/dist/utils.js +136 -0
  121. package/dist/world.d.ts +236 -0
  122. package/dist/world.d.ts.map +1 -0
  123. package/dist/world.js +275 -0
  124. package/package.json +73 -0
@@ -0,0 +1,97 @@
1
+ import type { GraphQLClient } from '../client.js';
2
+ import { type WalletBalanceQuery, type WalletTransactionsQuery, type WalletTransactionsConnectionQuery, type WalletTransactionsConnectionQueryVariables, type AppBudgetQuery, type AppBudgetsQuery, type SetAppBudgetMutation, type BuddyBillingTiersQuery, type GraphqlBillingTiersQuery, type PostgresBillingTiersQuery } from '../generated/graphql.js';
3
+ /**
4
+ * Org wallet + per-app budgets — exposed as `client.billing` (and grouped under
5
+ * `client.admin`).
6
+ *
7
+ * Targets the **management-api**. Reads require the `view_billing` org/app
8
+ * permission; {@link setAppBudget} requires `manage_billing`. Monetary values
9
+ * are minor currency units (`*Cents`) and serialized as `BigInt` decimal
10
+ * strings.
11
+ *
12
+ * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `FORBIDDEN` / `SCOPE_MISSING`
13
+ * per the permission notes above.
14
+ */
15
+ export declare class BillingAPI {
16
+ private readonly management;
17
+ constructor(management: GraphQLClient);
18
+ /**
19
+ * Return an organization's wallet balance. Requires the `view_billing` org
20
+ * permission.
21
+ *
22
+ * @param orgId - Numeric org id (`BigInt` as a decimal string).
23
+ * @returns The wallet balance (cents as a decimal string).
24
+ */
25
+ walletBalance(orgId: string): Promise<WalletBalanceQuery['walletBalance']>;
26
+ /**
27
+ * List an organization's wallet transactions (newest first). Requires the
28
+ * `view_billing` org permission.
29
+ *
30
+ * @param orgId - Numeric org id.
31
+ * @param opts - Optional `limit` / `offset` (default limit 50).
32
+ * @returns The wallet transactions.
33
+ */
34
+ walletTransactions(orgId: string, opts?: {
35
+ limit?: number;
36
+ offset?: number;
37
+ }): Promise<WalletTransactionsQuery['walletTransactions']>;
38
+ /**
39
+ * Return the spend budget for one app. Requires the `view_billing` app
40
+ * permission.
41
+ *
42
+ * @param orgId - Numeric org id that owns the app.
43
+ * @param appId - Numeric app id.
44
+ * @returns The app budget, or `null` if unset.
45
+ */
46
+ appBudget(orgId: string, appId: string): Promise<AppBudgetQuery['appBudget']>;
47
+ /**
48
+ * List the spend budgets for every app under an org. Requires the
49
+ * `view_billing` org permission.
50
+ *
51
+ * @param orgId - Numeric org id.
52
+ * @returns The app budgets.
53
+ */
54
+ appBudgets(orgId: string): Promise<AppBudgetsQuery['appBudgets']>;
55
+ /**
56
+ * Set (or clear) an app's monthly spend cap. Requires the `manage_billing`
57
+ * app permission.
58
+ *
59
+ * @param orgId - Numeric org id.
60
+ * @param appId - Numeric app id.
61
+ * @param monthlyLimitCents - Monthly cap in minor currency units (decimal
62
+ * string); `"0"` disables the cap.
63
+ * @returns The updated app budget.
64
+ */
65
+ setAppBudget(orgId: string, appId: string, monthlyLimitCents: string): Promise<SetAppBudgetMutation['setAppBudget']>;
66
+ /**
67
+ * Relay-style cursor pagination over an org's wallet transactions — the
68
+ * preferred alternative to {@link walletTransactions}. Requires the
69
+ * `view_billing` org permission. See
70
+ * https://docs.crowdedkingdoms.com/overview/pagination.
71
+ *
72
+ * @param args - `orgId` plus optional `first` and `after`.
73
+ * @returns A wallet-transactions connection.
74
+ */
75
+ walletTransactionsConnection(args: WalletTransactionsConnectionQueryVariables): Promise<WalletTransactionsConnectionQuery['walletTransactionsConnection']>;
76
+ /**
77
+ * Buddy (UDP replication) capacity billing-tier catalog. **Public.** Each
78
+ * tier lists its messages/sec + bandwidth allotment and capacity charge; use
79
+ * with {@link EnvironmentsAPI.updateBillingTiers} to set an environment's tier.
80
+ *
81
+ * @returns The Buddy billing tiers.
82
+ */
83
+ buddyTiers(): Promise<BuddyBillingTiersQuery['buddyBillingTiers']>;
84
+ /**
85
+ * GraphQL (Game API) capacity billing-tier catalog. **Public.**
86
+ *
87
+ * @returns The GraphQL billing tiers.
88
+ */
89
+ graphqlTiers(): Promise<GraphqlBillingTiersQuery['graphqlBillingTiers']>;
90
+ /**
91
+ * Postgres capacity billing-tier catalog. **Public.**
92
+ *
93
+ * @returns The Postgres billing tiers.
94
+ */
95
+ postgresTiers(): Promise<PostgresBillingTiersQuery['postgresBillingTiers']>;
96
+ }
97
+ //# sourceMappingURL=billing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/domains/billing.ts"],"names":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AMG;IACG,UAAU,IAAI,OAAO,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;IAKxE;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAC3B,wBAAwB,CAAC,qBAAqB,CAAC,CAChD;IAKD;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAC5B,yBAAyB,CAAC,sBAAsB,CAAC,CAClD;CAIF"}
@@ -0,0 +1,131 @@
1
+ import { WalletBalanceDocument, WalletTransactionsDocument, WalletTransactionsConnectionDocument, AppBudgetDocument, AppBudgetsDocument, SetAppBudgetDocument, BuddyBillingTiersDocument, GraphqlBillingTiersDocument, PostgresBillingTiersDocument, } from '../generated/graphql.js';
2
+ /**
3
+ * Org wallet + per-app budgets — exposed as `client.billing` (and grouped under
4
+ * `client.admin`).
5
+ *
6
+ * Targets the **management-api**. Reads require the `view_billing` org/app
7
+ * permission; {@link setAppBudget} requires `manage_billing`. Monetary values
8
+ * are minor currency units (`*Cents`) and serialized as `BigInt` decimal
9
+ * strings.
10
+ *
11
+ * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `FORBIDDEN` / `SCOPE_MISSING`
12
+ * per the permission notes above.
13
+ */
14
+ export class BillingAPI {
15
+ constructor(management) {
16
+ this.management = management;
17
+ }
18
+ /**
19
+ * Return an organization's wallet balance. Requires the `view_billing` org
20
+ * permission.
21
+ *
22
+ * @param orgId - Numeric org id (`BigInt` as a decimal string).
23
+ * @returns The wallet balance (cents as a decimal string).
24
+ */
25
+ async walletBalance(orgId) {
26
+ const data = await this.management.request(WalletBalanceDocument, { orgId });
27
+ return data.walletBalance;
28
+ }
29
+ /**
30
+ * List an organization's wallet transactions (newest first). Requires the
31
+ * `view_billing` org permission.
32
+ *
33
+ * @param orgId - Numeric org id.
34
+ * @param opts - Optional `limit` / `offset` (default limit 50).
35
+ * @returns The wallet transactions.
36
+ */
37
+ async walletTransactions(orgId, opts = {}) {
38
+ const data = await this.management.request(WalletTransactionsDocument, {
39
+ orgId,
40
+ limit: opts.limit,
41
+ offset: opts.offset,
42
+ });
43
+ return data.walletTransactions;
44
+ }
45
+ /**
46
+ * Return the spend budget for one app. Requires the `view_billing` app
47
+ * permission.
48
+ *
49
+ * @param orgId - Numeric org id that owns the app.
50
+ * @param appId - Numeric app id.
51
+ * @returns The app budget, or `null` if unset.
52
+ */
53
+ async appBudget(orgId, appId) {
54
+ const data = await this.management.request(AppBudgetDocument, {
55
+ orgId,
56
+ appId,
57
+ });
58
+ return data.appBudget;
59
+ }
60
+ /**
61
+ * List the spend budgets for every app under an org. Requires the
62
+ * `view_billing` org permission.
63
+ *
64
+ * @param orgId - Numeric org id.
65
+ * @returns The app budgets.
66
+ */
67
+ async appBudgets(orgId) {
68
+ const data = await this.management.request(AppBudgetsDocument, { orgId });
69
+ return data.appBudgets;
70
+ }
71
+ /**
72
+ * Set (or clear) an app's monthly spend cap. Requires the `manage_billing`
73
+ * app permission.
74
+ *
75
+ * @param orgId - Numeric org id.
76
+ * @param appId - Numeric app id.
77
+ * @param monthlyLimitCents - Monthly cap in minor currency units (decimal
78
+ * string); `"0"` disables the cap.
79
+ * @returns The updated app budget.
80
+ */
81
+ async setAppBudget(orgId, appId, monthlyLimitCents) {
82
+ const data = await this.management.request(SetAppBudgetDocument, {
83
+ orgId,
84
+ appId,
85
+ monthlyLimitCents,
86
+ });
87
+ return data.setAppBudget;
88
+ }
89
+ /**
90
+ * Relay-style cursor pagination over an org's wallet transactions — the
91
+ * preferred alternative to {@link walletTransactions}. Requires the
92
+ * `view_billing` org permission. See
93
+ * https://docs.crowdedkingdoms.com/overview/pagination.
94
+ *
95
+ * @param args - `orgId` plus optional `first` and `after`.
96
+ * @returns A wallet-transactions connection.
97
+ */
98
+ async walletTransactionsConnection(args) {
99
+ const data = await this.management.request(WalletTransactionsConnectionDocument, args);
100
+ return data.walletTransactionsConnection;
101
+ }
102
+ /**
103
+ * Buddy (UDP replication) capacity billing-tier catalog. **Public.** Each
104
+ * tier lists its messages/sec + bandwidth allotment and capacity charge; use
105
+ * with {@link EnvironmentsAPI.updateBillingTiers} to set an environment's tier.
106
+ *
107
+ * @returns The Buddy billing tiers.
108
+ */
109
+ async buddyTiers() {
110
+ const data = await this.management.request(BuddyBillingTiersDocument);
111
+ return data.buddyBillingTiers;
112
+ }
113
+ /**
114
+ * GraphQL (Game API) capacity billing-tier catalog. **Public.**
115
+ *
116
+ * @returns The GraphQL billing tiers.
117
+ */
118
+ async graphqlTiers() {
119
+ const data = await this.management.request(GraphqlBillingTiersDocument);
120
+ return data.graphqlBillingTiers;
121
+ }
122
+ /**
123
+ * Postgres capacity billing-tier catalog. **Public.**
124
+ *
125
+ * @returns The Postgres billing tiers.
126
+ */
127
+ async postgresTiers() {
128
+ const data = await this.management.request(PostgresBillingTiersDocument);
129
+ return data.postgresBillingTiers;
130
+ }
131
+ }
@@ -0,0 +1,293 @@
1
+ import type { GraphQLClient } from '../client.js';
2
+ import { type MyChannelsQuery, type MyChannelsQueryVariables, type ChannelsQuery, type ChannelsQueryVariables, type ChannelQuery, type ChannelQueryVariables, type ChannelMembersQuery, type ChannelMembersQueryVariables, type ChannelRolesQuery, type ChannelRolesQueryVariables, type ChannelPolicyQuery, type ChannelPolicyQueryVariables, type SetChannelPolicyMutation, type SetChannelPolicyMutationVariables, type CreateChannelMutation, type CreateChannelMutationVariables, type UpdateChannelMutation, type UpdateChannelMutationVariables, type DeleteChannelMutationVariables, type JoinChannelMutation, type JoinChannelMutationVariables, type RequestToJoinChannelMutation, type RequestToJoinChannelMutationVariables, type LeaveChannelMutationVariables, type AddChannelMemberMutation, type AddChannelMemberMutationVariables, type RemoveChannelMemberMutationVariables, type SetChannelMemberRolesMutation, type SetChannelMemberRolesMutationVariables, type CreateChannelRoleMutation, type CreateChannelRoleMutationVariables, type UpdateChannelRoleMutation, type UpdateChannelRoleMutationVariables, type DeleteChannelRoleMutationVariables } from '../generated/graphql.js';
3
+ /**
4
+ * Channels: app-scoped, location-independent pub/sub messaging groups on the
5
+ * **game-api**. Exposed as `client.channels`.
6
+ *
7
+ * A channel is a named subscriber set with role-gated messaging, built on the
8
+ * same generic groups subsystem as Teams (`group_type='channel'`). The methods
9
+ * here manage a channel's lifecycle and configuration — creating channels,
10
+ * listing/fetching them, managing membership (join/leave/add/remove), roles,
11
+ * and the per-app channel policy — all over the game-api GraphQL endpoint.
12
+ *
13
+ * Realtime message delivery is a **separate** path: publish to a channel with
14
+ * `client.udp.sendChannelMessage(...)` over UDP. That call requires the
15
+ * channel's `send_messages` permission and fans the payload out to every
16
+ * active member (as a `ChannelMessageNotification` on `client.udp`
17
+ * notifications) rather than chunk-routing it. The methods on this class never
18
+ * carry message payloads — they only manage who belongs to a channel and what
19
+ * each member may do.
20
+ *
21
+ * `BigInt` ids (`appId`, `groupId`, `userId`, `groupRoleId`) are sent and
22
+ * received as decimal strings.
23
+ *
24
+ * Every method requires an authenticated session (a Bearer token set via
25
+ * `client.auth.login()` or `client.setToken()`) and the caller must be
26
+ * entitled to the target app; membership/role/policy mutations additionally
27
+ * require a specific channel permission (e.g. `manage_group`, `manage_members`,
28
+ * `manage_roles`) or app-admin (`manage_apps`). Failures throw
29
+ * {@link CrowdyGraphQLError} carrying a stable `extensions.code` such as
30
+ * `UNAUTHENTICATED`, `SCOPE_MISSING`, or `FORBIDDEN`.
31
+ */
32
+ export declare class ChannelsAPI {
33
+ private gql;
34
+ constructor(gql: GraphQLClient);
35
+ /**
36
+ * List the caller's own channels in an app, each with the caller's roles and
37
+ * effective channel permissions (e.g. whether they hold `send_messages`). Use
38
+ * this to discover which channels the current user can read and post in.
39
+ *
40
+ * @param appId - The app (tenant) to list the caller's channels within, as a
41
+ * decimal `BigInt` string.
42
+ * @returns One {@link GroupMembership} per channel the caller belongs to
43
+ * (the channel {@link Group}, the caller's {@link GroupRole}s, their
44
+ * effective permission keys, and the join time).
45
+ * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` if there is no valid token,
46
+ * or `SCOPE_MISSING` / `FORBIDDEN` if the caller isn't entitled to the app.
47
+ */
48
+ mine(appId: MyChannelsQueryVariables['appId']): Promise<MyChannelsQuery['myChannels']>;
49
+ /**
50
+ * List all active channels in an app — not just the caller's. Use
51
+ * {@link mine} instead when you only want the channels the caller belongs to.
52
+ *
53
+ * @param appId - The app (tenant) whose channels to list, as a decimal
54
+ * `BigInt` string.
55
+ * @returns Every active channel in the app as {@link Group} records.
56
+ * @throws {CrowdyGraphQLError} `UNAUTHENTICATED`, or `SCOPE_MISSING` /
57
+ * `FORBIDDEN` if the caller isn't entitled to the app.
58
+ */
59
+ list(appId: ChannelsQueryVariables['appId']): Promise<ChannelsQuery['channels']>;
60
+ /**
61
+ * Fetch a single channel by its group id.
62
+ *
63
+ * @param groupId - The channel's group id, as a decimal `BigInt` string.
64
+ * @returns The channel as a {@link Group}.
65
+ * @throws {CrowdyGraphQLError} if the id does not resolve to a channel (e.g.
66
+ * it is a team, or does not exist), or `UNAUTHENTICATED` / `FORBIDDEN` if
67
+ * the caller isn't entitled to the app.
68
+ */
69
+ get(groupId: ChannelQueryVariables['groupId']): Promise<ChannelQuery['channel']>;
70
+ /**
71
+ * List a channel's members — its subscriber set, including pending join
72
+ * requests — each with their membership status and roles.
73
+ *
74
+ * @param groupId - The channel whose members to list, as a decimal `BigInt`
75
+ * string.
76
+ * @returns The channel's members as {@link GroupMember} records.
77
+ * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `FORBIDDEN` if the caller
78
+ * isn't entitled to the channel's app.
79
+ */
80
+ members(groupId: ChannelMembersQueryVariables['groupId']): Promise<ChannelMembersQuery['channelMembers']>;
81
+ /**
82
+ * List a channel's roles, including the system `leader` role and any default
83
+ * `member` role (which typically grants `send_messages`).
84
+ *
85
+ * @param groupId - The channel whose roles to list, as a decimal `BigInt`
86
+ * string.
87
+ * @returns The channel's roles as {@link GroupRole} records, each with its
88
+ * granted permission keys.
89
+ * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `FORBIDDEN` if the caller
90
+ * isn't entitled to the channel's app.
91
+ */
92
+ roles(groupId: ChannelRolesQueryVariables['groupId']): Promise<ChannelRolesQuery['channelRoles']>;
93
+ /**
94
+ * Read an app's current channel policy: who may create channels and the
95
+ * default membership policy applied to new channels. Falls back to app
96
+ * defaults when unset.
97
+ *
98
+ * @param appId - The app (tenant) whose channel policy to read, as a decimal
99
+ * `BigInt` string.
100
+ * @returns The effective {@link AppGroupPolicy} for channels in the app
101
+ * (creation policy, default membership policy, and any member/group caps).
102
+ * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `FORBIDDEN` if the caller
103
+ * isn't entitled to the app.
104
+ */
105
+ policy(appId: ChannelPolicyQueryVariables['appId']): Promise<ChannelPolicyQuery['channelPolicy']>;
106
+ /**
107
+ * Create a channel in an app. Whether the caller may create one is governed
108
+ * by the per-app channel creation policy (`admin` | `member` | `anyone`).
109
+ * The caller becomes the owner with a system `leader` role. When
110
+ * `input.membersCanSend` is true (the default) a default `member` role
111
+ * granting `send_messages` is created and auto-assigned to joiners (an open
112
+ * chat channel); when false, only roles you explicitly grant may post (an
113
+ * announce / read-only channel).
114
+ *
115
+ * @param input - {@link CreateChannelInput}: the owning `appId`, the channel
116
+ * `name` (max 128 chars, unique per app + type), and optional
117
+ * `description`, `membershipPolicy` (`open` | `request` | `invite` |
118
+ * `admin`; defaults to the app policy), and `membersCanSend` flag.
119
+ * @returns The newly created channel as a {@link Group}.
120
+ * @throws {CrowdyGraphQLError} `BAD_USER_INPUT` (e.g. name too long or a
121
+ * duplicate name), `FORBIDDEN` if the channel policy disallows creation, or
122
+ * `UNAUTHENTICATED`.
123
+ */
124
+ create(input: CreateChannelMutationVariables['input']): Promise<CreateChannelMutation['createChannel']>;
125
+ /**
126
+ * Update a channel's name, description, and/or membership policy. Only the
127
+ * fields present on `input` change; omitted fields are left as-is. Requires
128
+ * the `manage_group` channel permission (app admins bypass).
129
+ *
130
+ * @param input - {@link UpdateChannelInput}: the `groupId` plus the fields to
131
+ * change — `name` (max 128 chars), `description`, and/or `membershipPolicy`
132
+ * (`open` | `request` | `invite` | `admin`).
133
+ * @returns The updated channel as a {@link Group}.
134
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` / `SCOPE_MISSING` if the caller
135
+ * lacks `manage_group`, `BAD_USER_INPUT` on a validation failure, or
136
+ * `UNAUTHENTICATED`.
137
+ */
138
+ update(input: UpdateChannelMutationVariables['input']): Promise<UpdateChannelMutation['updateChannel']>;
139
+ /**
140
+ * Delete a channel. Requires the `manage_group` channel permission (app
141
+ * admins bypass). **Destructive**: cascades to the channel's members and
142
+ * roles and notifies Buddy servers to tear down message routing for the
143
+ * channel.
144
+ *
145
+ * @param groupId - The channel to delete, as a decimal `BigInt` string.
146
+ * @returns `true` on success.
147
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` / `SCOPE_MISSING` if the caller
148
+ * lacks `manage_group`, or `UNAUTHENTICATED`.
149
+ */
150
+ remove(groupId: DeleteChannelMutationVariables['groupId']): Promise<boolean>;
151
+ /**
152
+ * Set who may create channels in an app and the default membership policy
153
+ * for new channels. Requires app-admin (`manage_apps`). Affects future
154
+ * channel creation only — existing channels are unchanged.
155
+ *
156
+ * @param input - {@link SetChannelPolicyInput}: the `appId`, the
157
+ * `creationPolicy` (`admin` | `member` | `anyone`), the
158
+ * `defaultMembershipPolicy` (`open` | `request` | `invite` | `admin`), and
159
+ * optional `maxMembers` / `maxGroupsPerUser` caps (`null` = unlimited).
160
+ * @returns The updated {@link AppGroupPolicy}.
161
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` / `SCOPE_MISSING` if the caller
162
+ * isn't app-admin, `BAD_USER_INPUT` on an invalid policy value, or
163
+ * `UNAUTHENTICATED`.
164
+ */
165
+ setPolicy(input: SetChannelPolicyMutationVariables['input']): Promise<SetChannelPolicyMutation['setChannelPolicy']>;
166
+ /**
167
+ * Join a channel as the caller (subscribe to it). Honors the channel's
168
+ * membership policy: `open` → active immediately; `request` → pending until
169
+ * a manager approves; `invite` / `admin` → rejected. On becoming active,
170
+ * Buddy is notified with the caller's effective send permission so message
171
+ * routing starts.
172
+ *
173
+ * @param groupId - The channel to join, as a decimal `BigInt` string.
174
+ * @returns The caller's {@link GroupMember} record; its `status` reflects
175
+ * `active` vs. `pending`.
176
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` if the membership policy rejects
177
+ * the join, or `UNAUTHENTICATED`.
178
+ */
179
+ join(groupId: JoinChannelMutationVariables['groupId']): Promise<JoinChannelMutation['joinChannel']>;
180
+ /**
181
+ * Request to join a request-only channel, creating a pending membership a
182
+ * manager can later approve via {@link addMember}. Behaves identically to
183
+ * {@link join}; it exists as a clearer name for request-policy UIs.
184
+ *
185
+ * @param groupId - The request-only channel to request to join, as a decimal
186
+ * `BigInt` string.
187
+ * @returns The caller's pending {@link GroupMember} record.
188
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` if the membership policy rejects
189
+ * the request, or `UNAUTHENTICATED`.
190
+ */
191
+ requestToJoin(groupId: RequestToJoinChannelMutationVariables['groupId']): Promise<RequestToJoinChannelMutation['requestToJoinChannel']>;
192
+ /**
193
+ * Leave a channel (unsubscribe the caller). Notifies Buddy to stop routing
194
+ * messages to the caller.
195
+ *
196
+ * @param groupId - The channel to leave, as a decimal `BigInt` string.
197
+ * @returns `true` if a membership was removed (`false` if the caller wasn't
198
+ * a member).
199
+ * @throws {CrowdyGraphQLError} `UNAUTHENTICATED`.
200
+ */
201
+ leave(groupId: LeaveChannelMutationVariables['groupId']): Promise<boolean>;
202
+ /**
203
+ * Add a user to a channel, or approve their pending join request (upserts
204
+ * the membership to `active`). Requires the `manage_members` channel
205
+ * permission (app admins bypass). Auto-assigns the channel's default role if
206
+ * configured and notifies Buddy with the member's effective send permission.
207
+ *
208
+ * @param groupId - The channel to add the user to, as a decimal `BigInt`
209
+ * string.
210
+ * @param userId - The user to add or approve, as a decimal `BigInt` string.
211
+ * @returns The added/approved {@link GroupMember} record.
212
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` / `SCOPE_MISSING` if the caller
213
+ * lacks `manage_members`, or `UNAUTHENTICATED`.
214
+ */
215
+ addMember(groupId: AddChannelMemberMutationVariables['groupId'], userId: AddChannelMemberMutationVariables['userId']): Promise<AddChannelMemberMutation['addChannelMember']>;
216
+ /**
217
+ * Remove a member from a channel. Requires the `manage_members` channel
218
+ * permission, except that any member may remove themselves (pass their own
219
+ * `userId`). Notifies Buddy to stop routing messages to the removed member.
220
+ *
221
+ * @param groupId - The channel to remove the user from, as a decimal
222
+ * `BigInt` string.
223
+ * @param userId - The user to remove; may be the caller's own id to
224
+ * self-remove. Decimal `BigInt` string.
225
+ * @returns `true` if a membership was removed.
226
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` / `SCOPE_MISSING` when removing
227
+ * another member without `manage_members`, or `UNAUTHENTICATED`.
228
+ */
229
+ removeMember(groupId: RemoveChannelMemberMutationVariables['groupId'], userId: RemoveChannelMemberMutationVariables['userId']): Promise<boolean>;
230
+ /**
231
+ * Replace a member's channel roles with the given set. This is **not
232
+ * additive** — roles not listed are removed. Requires the `manage_roles`
233
+ * channel permission (app admins bypass). Re-pushes the member's effective
234
+ * send permission to Buddy so their ability to post updates immediately.
235
+ *
236
+ * @param input - {@link SetMemberRolesInput}: the `groupId`, the target
237
+ * `userId`, and `roleIds` — the complete set of channel role ids the member
238
+ * should have (ids that are unknown or belong to another group are
239
+ * ignored).
240
+ * @returns The updated {@link GroupMember} record with its new roles.
241
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` / `SCOPE_MISSING` if the caller
242
+ * lacks `manage_roles`, or `UNAUTHENTICATED`.
243
+ */
244
+ setMemberRoles(input: SetChannelMemberRolesMutationVariables['input']): Promise<SetChannelMemberRolesMutation['setChannelMemberRoles']>;
245
+ /**
246
+ * Create a custom (non-system) channel role granting the given channel
247
+ * permission keys (e.g. `send_messages` for posting rights). Requires the
248
+ * `manage_roles` channel permission (app admins bypass).
249
+ *
250
+ * @param input - {@link CreateGroupRoleInput}: the `groupId`, the `roleName`
251
+ * (max 128 chars, unique within the channel), the `permissions` keys to
252
+ * grant (e.g. `send_messages`, `manage_members`; each max 64 chars,
253
+ * defaults to none), and an optional `rank` (higher = more senior;
254
+ * defaults to 0).
255
+ * @returns The created {@link GroupRole}.
256
+ * @throws {CrowdyGraphQLError} `BAD_USER_INPUT` on an invalid/duplicate name
257
+ * or unknown permission key, `FORBIDDEN` / `SCOPE_MISSING` if the caller
258
+ * lacks `manage_roles`, or `UNAUTHENTICATED`.
259
+ */
260
+ createRole(input: CreateChannelRoleMutationVariables['input']): Promise<CreateChannelRoleMutation['createChannelRole']>;
261
+ /**
262
+ * Update a channel role's name, rank, and/or permission keys (system roles
263
+ * cannot be renamed or re-ranked). When `input.permissions` is supplied it
264
+ * **replaces** the role's existing keys. Requires the `manage_roles` channel
265
+ * permission (app admins bypass).
266
+ *
267
+ * Note: changing `send_messages` here does not re-push to Buddy until each
268
+ * affected member's roles are re-applied via {@link setMemberRoles}.
269
+ *
270
+ * @param input - {@link UpdateGroupRoleInput}: the `groupRoleId` plus the
271
+ * fields to change (`roleName`, `permissions`, `rank`); omitted fields are
272
+ * left unchanged.
273
+ * @returns The updated {@link GroupRole}.
274
+ * @throws {CrowdyGraphQLError} `BAD_USER_INPUT` on a validation failure,
275
+ * `FORBIDDEN` / `SCOPE_MISSING` if the caller lacks `manage_roles`, or
276
+ * `UNAUTHENTICATED`.
277
+ */
278
+ updateRole(input: UpdateChannelRoleMutationVariables['input']): Promise<UpdateChannelRoleMutation['updateChannelRole']>;
279
+ /**
280
+ * Delete a non-system channel role. Requires the `manage_roles` channel
281
+ * permission (app admins bypass). The system `leader` role cannot be
282
+ * deleted. **Destructive**: removes the role from any members that held it.
283
+ *
284
+ * @param groupRoleId - The channel role to delete (must be a non-system
285
+ * role), as a decimal `BigInt` string.
286
+ * @returns `true` if a role was deleted.
287
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` / `SCOPE_MISSING` if the caller
288
+ * lacks `manage_roles`, `BAD_USER_INPUT` if targeting a system role, or
289
+ * `UNAUTHENTICATED`.
290
+ */
291
+ deleteRole(groupRoleId: DeleteChannelRoleMutationVariables['groupRoleId']): Promise<boolean>;
292
+ }
293
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/domains/channels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAE7B,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAE3B,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAE1B,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EAEjC,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAE/B,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAEhC,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EAEtC,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EAEnC,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EAEnC,KAAK,8BAA8B,EAEnC,KAAK,mBAAmB,EACxB,KAAK,4BAA4B,EAEjC,KAAK,4BAA4B,EACjC,KAAK,qCAAqC,EAE1C,KAAK,6BAA6B,EAElC,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,EAEtC,KAAK,oCAAoC,EAEzC,KAAK,6BAA6B,EAClC,KAAK,sCAAsC,EAE3C,KAAK,yBAAyB,EAC9B,KAAK,kCAAkC,EAEvC,KAAK,yBAAyB,EAC9B,KAAK,kCAAkC,EAEvC,KAAK,kCAAkC,EACxC,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,aAAa;IAItC;;;;;;;;;;;;OAYG;IACG,IAAI,CACR,KAAK,EAAE,wBAAwB,CAAC,OAAO,CAAC,GACvC,OAAO,CA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