dfx 0.105.0 → 0.107.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.
package/src/types.ts CHANGED
@@ -98,25 +98,25 @@ export interface ActivityInstance {
98
98
  readonly instance_id: string
99
99
  /** Unique identifier for the launch */
100
100
  readonly launch_id: Snowflake
101
- /** The Location the instance is runnning in */
101
+ /** Location the instance is runnning in */
102
102
  readonly location: ActivityLocation
103
- /** The IDs of the Users currently connected to the instance */
103
+ /** IDs of the Users currently connected to the instance */
104
104
  readonly users: Array<Snowflake>
105
105
  }
106
106
  export interface ActivityLocation {
107
- /** The unique identifier for the location */
107
+ /** Unique identifier for the location */
108
108
  readonly id: string
109
109
  /** Enum describing kind of location */
110
110
  readonly kind: ActivityLocationKind
111
- /** The id of the Channel */
111
+ /** ID of the Channel */
112
112
  readonly channel_id: Snowflake
113
- /** The id of the Guild */
113
+ /** ID of the Guild */
114
114
  readonly guild_id?: Snowflake | null
115
115
  }
116
116
  export enum ActivityLocationKind {
117
- /** The Location is a Guild Channel */
117
+ /** Location is a Guild Channel */
118
118
  GC = "'gc'",
119
- /** The Location is a Private Channel, such as a DM or GDM */
119
+ /** Location is a Private Channel, such as a DM or GDM */
120
120
  PC = "'pc'",
121
121
  }
122
122
  export interface ActivityParty {
@@ -232,6 +232,12 @@ export interface Application {
232
232
  readonly interactions_endpoint_url?: string | null
233
233
  /** Role connection verification URL for the app */
234
234
  readonly role_connections_verification_url?: string | null
235
+ /** Event webhooks URL for the app to receive webhook events */
236
+ readonly event_webhooks_url?: string | null
237
+ /** If webhook events are enabled for the app. 1 (default) means disabled, 2 means enabled, and 3 means disabled by Discord */
238
+ readonly event_webhooks_status: ApplicationEventWebhookStatus
239
+ /** List of Webhook event types the app subscribes to */
240
+ readonly event_webhooks_types?: Array<EventType>
235
241
  /** List of tags describing the content and functionality of the app. Max of 5 tags. */
236
242
  readonly tags?: Array<string>
237
243
  /** Settings for the app's default in-app authorization link, if enabled */
@@ -241,6 +247,16 @@ export interface Application {
241
247
  /** Default custom authorization URL for the app, if enabled */
242
248
  readonly custom_install_url?: string
243
249
  }
250
+ export interface ApplicationAuthorized {
251
+ /** Installation context for the authorization. Either guild (0) if installed to a server or user (1) if installed to a user's account */
252
+ readonly integration_type?: ApplicationIntegrationType
253
+ /** User who authorized the app */
254
+ readonly user: User
255
+ /** List of scopes the user authorized */
256
+ readonly scopes: Array<OAuth2Scope>
257
+ /** Server which app was authorized for (when integration type is 0) */
258
+ readonly guild?: Guild
259
+ }
244
260
  export interface ApplicationCommand {
245
261
  /** Unique ID of command */
246
262
  readonly id: Snowflake
@@ -305,6 +321,22 @@ export interface ApplicationCommandInteractionDataOption {
305
321
  /** true if this option is the currently focused option for autocomplete */
306
322
  readonly focused?: boolean
307
323
  }
324
+ export interface ApplicationCommandInteractionMetadatum {
325
+ /** ID of the interaction */
326
+ readonly id: Snowflake
327
+ /** Type of interaction */
328
+ readonly type: InteractionType
329
+ /** User who triggered the interaction */
330
+ readonly user: User
331
+ /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
332
+ readonly authorizing_integration_owners: ApplicationIntegrationType
333
+ /** ID of the original response message, present only on follow-up messages */
334
+ readonly original_response_message_id?: Snowflake
335
+ /** The user the command was run on, present only on user command interactions */
336
+ readonly target_user?: User
337
+ /** The ID of the message the command was run on, present only on message command interactions. The original response message will also have message_reference and referenced_message pointing to this message. */
338
+ readonly target_message_id?: Snowflake
339
+ }
308
340
  export interface ApplicationCommandOption {
309
341
  /** Type of option */
310
342
  readonly type: any
@@ -381,6 +413,14 @@ export enum ApplicationCommandType {
381
413
  /** A UI-based command that represents the primary way to invoke an app's Activity */
382
414
  PRIMARY_ENTRY_POINT = 4,
383
415
  }
416
+ export enum ApplicationEventWebhookStatus {
417
+ /** Webhook events are disabled by developer */
418
+ DISABLED = 1,
419
+ /** Webhook events are enabled by developer */
420
+ ENABLED = 2,
421
+ /** Webhook events are disabled by Discord, usually due to inactivity */
422
+ DISABLED_BY_DISCORD = 3,
423
+ }
384
424
  export const ApplicationFlag = {
385
425
  /** Indicates if an app uses the Auto Moderation API */
386
426
  APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE: 1 << 6,
@@ -1974,6 +2014,12 @@ export function createRoutes<O = any>(
1974
2014
  url: `/guilds/${guildId}/voice-states/@me`,
1975
2015
  options,
1976
2016
  }),
2017
+ getEntitlement: (applicationId, entitlementId, options) =>
2018
+ fetch({
2019
+ method: "GET",
2020
+ url: `/applications/${applicationId}/entitlements/${entitlementId}`,
2021
+ options,
2022
+ }),
1977
2023
  getFollowupMessage: (
1978
2024
  applicationId,
1979
2025
  interactionToken,
@@ -2796,6 +2842,12 @@ export interface EditCurrentApplicationParams {
2796
2842
  readonly interactions_endpoint_url: string
2797
2843
  /** List of tags describing the content and functionality of the app (max of 20 characters per tag). Max of 5 tags. */
2798
2844
  readonly tags: Array<string>
2845
+ /** Event webhooks URL for the app to receive webhook events */
2846
+ readonly event_webhooks_url: string
2847
+ /** If webhook events are enabled for the app. 1 to disable, and 2 to enable */
2848
+ readonly event_webhooks_status: ApplicationEventWebhookStatus
2849
+ /** List of Webhook event types to subscribe to */
2850
+ readonly event_webhooks_types: Array<EventType>
2799
2851
  }
2800
2852
  export interface EditGlobalApplicationCommandParams {
2801
2853
  /** Name of command, 1-32 characters */
@@ -3526,7 +3578,7 @@ The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji
3526
3578
  getCurrentBotApplicationInformation: (
3527
3579
  options?: O,
3528
3580
  ) => RestResponse<Application>
3529
- /** Returns the user object of the requester's account. For OAuth2, this requires the identify scope, which will return the object without an email, and optionally the email scope, which returns the object with an email. */
3581
+ /** Returns the user object of the requester's account. For OAuth2, this requires the identify scope, which will return the object without an email, and optionally the email scope, which returns the object with an email if the user has one. */
3530
3582
  getCurrentUser: (options?: O) => RestResponse<User>
3531
3583
  /** Returns the application role connection for the user. Requires an OAuth2 access token with role_connections.write scope for the application specified in the path. */
3532
3584
  getCurrentUserApplicationRoleConnection: (
@@ -3550,6 +3602,12 @@ The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji
3550
3602
  guildId: string,
3551
3603
  options?: O,
3552
3604
  ) => RestResponse<VoiceState>
3605
+ /** Returns an entitlement. */
3606
+ getEntitlement: (
3607
+ applicationId: string,
3608
+ entitlementId: string,
3609
+ options?: O,
3610
+ ) => RestResponse<any>
3553
3611
  /** Returns a followup message for an Interaction. Functions the same as Get Webhook Message. */
3554
3612
  getFollowupMessage: (
3555
3613
  applicationId: string,
@@ -4159,6 +4217,7 @@ export interface Entitlement {
4159
4217
  readonly consumed?: boolean
4160
4218
  }
4161
4219
  export type EntitlementCreateEvent = Entitlement
4220
+ export type EntitlementCreateStructureEvent = Entitlement
4162
4221
  export type EntitlementDeleteEvent = Entitlement
4163
4222
  export enum EntitlementType {
4164
4223
  /** Entitlement was purchased by user */
@@ -4183,6 +4242,22 @@ export enum EntryPointCommandHandlerType {
4183
4242
  APP_HANDLER = 1,
4184
4243
  DISCORD_LAUNCH_ACTIVITY = 2,
4185
4244
  }
4245
+ export interface EventBody {
4246
+ /** Event type */
4247
+ readonly type: EventType
4248
+ /** Timestamp of when the event occurred in ISO8601 format */
4249
+ readonly timestamp: string
4250
+ /** Data for the event. The shape depends on the event type */
4251
+ readonly data?: EventType
4252
+ }
4253
+ export enum EventType {
4254
+ /** Sent when an app was authorized by a user to a server or their account */
4255
+ APPLICATION_AUTHORIZED = "APPLICATION_AUTHORIZED",
4256
+ /** Entitlement was created */
4257
+ ENTITLEMENT_CREATE = "ENTITLEMENT_CREATE",
4258
+ /** User was added to a Quest (currently unavailable) */
4259
+ QUEST_USER_ENROLLMENT = "QUEST_USER_ENROLLMENT",
4260
+ }
4186
4261
  export enum EventType {
4187
4262
  /** when a member sends or edits a message in the guild */
4188
4263
  MESSAGE_SEND = 1,
@@ -4694,6 +4769,8 @@ export interface GuildMember {
4694
4769
  readonly nick?: string | null
4695
4770
  /** the member's guild avatar hash */
4696
4771
  readonly avatar?: string | null
4772
+ /** the member's guild banner hash */
4773
+ readonly banner?: string | null
4697
4774
  /** array of role object ids */
4698
4775
  readonly roles: Array<Snowflake>
4699
4776
  /** when the user joined the guild */
@@ -4751,7 +4828,7 @@ export interface GuildMembersChunkEvent {
4751
4828
  readonly guild_id: Snowflake
4752
4829
  /** Set of guild members */
4753
4830
  readonly members: Array<GuildMember>
4754
- /** Chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count) */
4831
+ /** Chunk index in the expected chunks for this response (0 <= chunk\_index < chunk\_count) */
4755
4832
  readonly chunk_index: number
4756
4833
  /** Total number of expected chunks for this response */
4757
4834
  readonly chunk_count: number
@@ -4773,6 +4850,8 @@ export interface GuildMemberUpdateEvent {
4773
4850
  readonly nick?: string | null
4774
4851
  /** Member's guild avatar hash */
4775
4852
  readonly avatar?: string | null
4853
+ /** Member's guild banner hash */
4854
+ readonly banner?: string | null
4776
4855
  /** When the user joined the guild */
4777
4856
  readonly joined_at?: string | null
4778
4857
  /** When the user starting boosting the guild */
@@ -4996,7 +5075,12 @@ export interface GuildSoundboardSoundDeleteEvent {
4996
5075
  /** ID of the guild the sound was in */
4997
5076
  readonly guild_id: Snowflake
4998
5077
  }
4999
- export type GuildSoundboardSoundsUpdateEvent = SoundboardSound
5078
+ export interface GuildSoundboardSoundsUpdateEvent {
5079
+ /** The guild's soundboard sounds */
5080
+ readonly soundboard_sounds: Array<SoundboardSound>
5081
+ /** ID of the guild */
5082
+ readonly guild_id: Snowflake
5083
+ }
5000
5084
  export type GuildSoundboardSoundUpdateEvent = SoundboardSound
5001
5085
  export interface GuildStickersUpdateEvent {
5002
5086
  /** ID of the guild */
@@ -5023,7 +5107,7 @@ export interface GuildTemplate {
5023
5107
  readonly updated_at: string
5024
5108
  /** the ID of the guild this template is based on */
5025
5109
  readonly source_guild_id: Snowflake
5026
- /** the guild snapshot this template contains */
5110
+ /** the guild snapshot this template contains; placeholder IDs are given as integers */
5027
5111
  readonly serialized_source_guild: Guild
5028
5112
  /** whether the template has unsynced changes */
5029
5113
  readonly is_dirty?: boolean | null
@@ -5201,7 +5285,7 @@ export interface Interaction {
5201
5285
  readonly context?: InteractionContextType
5202
5286
  }
5203
5287
  export interface InteractionCallback {
5204
- /** */
5288
+ /** ID of the interaction */
5205
5289
  readonly id: Snowflake
5206
5290
  /** Interaction type */
5207
5291
  readonly type: InteractionType
@@ -5261,7 +5345,7 @@ export interface InteractionCallbackResource {
5261
5345
  readonly message?: Message
5262
5346
  }
5263
5347
  export interface InteractionCallbackResponse {
5264
- /** The interaction object associated with the */
5348
+ /** The interaction object associated with the interaction response. */
5265
5349
  readonly interaction: InteractionCallback
5266
5350
  /** The resource that was created by the interaction response. */
5267
5351
  readonly resource?: InteractionCallbackResource
@@ -5601,7 +5685,7 @@ export interface Message {
5601
5685
  readonly message_snapshots: Array<MessageSnapshot>
5602
5686
  /** the message associated with the message_reference */
5603
5687
  readonly referenced_message?: Message | null
5604
- /** In preview. Sent if the message is sent as a result of an interaction */
5688
+ /** Sent if the message is sent as a result of an interaction */
5605
5689
  readonly interaction_metadata?: MessageInteractionMetadatum
5606
5690
  /** Deprecated in favor of interaction_metadata; sent if the message is a response to an interaction */
5607
5691
  readonly interaction?: MessageInteraction
@@ -5652,6 +5736,20 @@ export interface MessageComponentDatum {
5652
5736
  /** Resolved entities from selected options */
5653
5737
  readonly resolved?: ResolvedDatum
5654
5738
  }
5739
+ export interface MessageComponentInteractionMetadatum {
5740
+ /** ID of the interaction */
5741
+ readonly id: Snowflake
5742
+ /** Type of interaction */
5743
+ readonly type: InteractionType
5744
+ /** User who triggered the interaction */
5745
+ readonly user: User
5746
+ /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
5747
+ readonly authorizing_integration_owners: ApplicationIntegrationType
5748
+ /** ID of the original response message, present only on follow-up messages */
5749
+ readonly original_response_message_id?: Snowflake
5750
+ /** ID of the message that contained the interactive component */
5751
+ readonly interacted_message_id: Snowflake
5752
+ }
5655
5753
  export type MessageCreateEvent = Message & MessageCreateExtra
5656
5754
  export interface MessageCreateExtra {
5657
5755
  /** ID of the guild the message was sent in - unless it is an ephemeral message */
@@ -5713,22 +5811,10 @@ export interface MessageInteraction {
5713
5811
  /** Member who invoked the interaction in the guild */
5714
5812
  readonly member?: GuildMember
5715
5813
  }
5716
- export interface MessageInteractionMetadatum {
5717
- /** ID of the interaction */
5718
- readonly id: Snowflake
5719
- /** Type of interaction */
5720
- readonly type: InteractionType
5721
- /** User who triggered the interaction */
5722
- readonly user: User
5723
- /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
5724
- readonly authorizing_integration_owners: ApplicationIntegrationType
5725
- /** ID of the original response message, present only on follow-up messages */
5726
- readonly original_response_message_id?: Snowflake
5727
- /** ID of the message that contained interactive component, present only on messages created from component interactions */
5728
- readonly interacted_message_id?: Snowflake
5729
- /** Metadata for the interaction that was used to open the modal, present only on modal submit interactions */
5730
- readonly triggering_interaction_metadata?: MessageInteractionMetadatum
5731
- }
5814
+ export type MessageInteractionMetadatum =
5815
+ | ApplicationCommandInteractionMetadatum
5816
+ | MessageComponentInteractionMetadatum
5817
+ | ModalSubmitInteractionMetadatum
5732
5818
  export interface MessagePollVoteAddEvent {
5733
5819
  /** ID of the user */
5734
5820
  readonly user_id: Snowflake
@@ -5883,6 +5969,20 @@ export interface ModalSubmitDatum {
5883
5969
  /** Values submitted by the user */
5884
5970
  readonly components: Array<Component>
5885
5971
  }
5972
+ export interface ModalSubmitInteractionMetadatum {
5973
+ /** ID of the interaction */
5974
+ readonly id: Snowflake
5975
+ /** Type of interaction */
5976
+ readonly type: InteractionType
5977
+ /** User who triggered the interaction */
5978
+ readonly user: User
5979
+ /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
5980
+ readonly authorizing_integration_owners: ApplicationIntegrationType
5981
+ /** ID of the original response message, present only on follow-up messages */
5982
+ readonly original_response_message_id?: Snowflake
5983
+ /** Metadata for the interaction that was used to open the modal */
5984
+ readonly triggering_interaction_metadata: ApplicationCommandInteractionMetadatum
5985
+ }
5886
5986
  export interface ModifyApplicationEmojiParams {
5887
5987
  /** name of the emoji */
5888
5988
  readonly name: string
@@ -7546,6 +7646,12 @@ export interface WebhooksUpdateEvent {
7546
7646
  /** ID of the channel */
7547
7647
  readonly channel_id: Snowflake
7548
7648
  }
7649
+ export enum WebhookType {
7650
+ /** PING event sent to verify your Webhook Event URL is active */
7651
+ PING = 0,
7652
+ /** Webhook event (details for event in event body object) */
7653
+ EVENT = 1,
7654
+ }
7549
7655
  export enum WebhookType {
7550
7656
  /** Incoming Webhooks can post messages to channels with a generated token */
7551
7657
  INCOMING = 1,
@@ -1,7 +1,7 @@
1
1
  import { pipe } from "effect/Function"
2
2
  import * as Deferred from "effect/Deferred"
3
3
  import * as Effect from "effect/Effect"
4
- import type * as Fiber from "effect/Fiber"
4
+ import * as Fiber from "effect/Fiber"
5
5
  import * as PubSub from "effect/PubSub"
6
6
  import * as Queue from "effect/Queue"
7
7
 
@@ -14,10 +14,10 @@ export const subscribeForEachPar = <R, E, A, X>(
14
14
  PubSub.subscribe(self),
15
15
  Effect.flatMap(queue =>
16
16
  Effect.forever(
17
- Effect.flatMap(Queue.take(queue), _ =>
17
+ Effect.flatMap(Queue.take(queue), a =>
18
18
  Effect.fork(
19
- Effect.catchAllCause(effect(_), _ =>
20
- Deferred.failCause(deferred, _),
19
+ Effect.catchAllCause(effect(a), cause =>
20
+ Deferred.failCause(deferred, cause),
21
21
  ),
22
22
  ),
23
23
  ),
@@ -27,45 +27,28 @@ export const subscribeForEachPar = <R, E, A, X>(
27
27
  Effect.interruptible,
28
28
  )
29
29
 
30
- return Effect.all([run, Deferred.await(deferred)], {
31
- concurrency: "unbounded",
32
- discard: true,
33
- }) as Effect.Effect<never, E, R>
30
+ return Effect.raceFirst(run, Deferred.await(deferred))
34
31
  })
35
32
 
36
33
  export const foreverSwitch = <R, E, A, R1, E1, X>(
37
34
  self: Effect.Effect<A, E, R>,
38
35
  f: (_: A) => Effect.Effect<X, E1, R1>,
39
36
  ): Effect.Effect<never, E | E1, R | R1> =>
40
- pipe(
41
- Effect.all([Deferred.make<never, E1>(), Effect.fiberId]),
42
- Effect.flatMap(([causeDeferred, fiberId]) => {
43
- let fiber: Fiber.RuntimeFiber<unknown, unknown> | undefined
44
-
45
- const run = pipe(
46
- self,
47
- Effect.tap(() =>
48
- fiber ? fiber.interruptAsFork(fiberId) : Effect.void,
49
- ),
50
- Effect.flatMap(_ =>
51
- pipe(
52
- f(_),
53
- Effect.tapErrorCause(_ => Deferred.failCause(causeDeferred, _)),
54
- Effect.fork,
55
- ),
56
- ),
57
- Effect.tap(fiber_ =>
58
- Effect.sync(() => {
37
+ Effect.gen(function* () {
38
+ const deferred = yield* Deferred.make<never, E1>()
39
+ let fiber: Fiber.RuntimeFiber<unknown, unknown> | undefined
40
+ return yield* self.pipe(
41
+ Effect.tap(() => (fiber ? Fiber.interruptFork(fiber) : Effect.void)),
42
+ Effect.flatMap(a =>
43
+ f(a).pipe(
44
+ Effect.catchAllCause(cause => Deferred.failCause(deferred, cause)),
45
+ Effect.fork,
46
+ Effect.tap(fiber_ => {
59
47
  fiber = fiber_
60
48
  }),
61
49
  ),
62
- Effect.forever,
63
- Effect.interruptible,
64
- )
65
-
66
- return Effect.all([run, Deferred.await(causeDeferred)], {
67
- concurrency: "unbounded",
68
- discard: true,
69
- }) as Effect.Effect<never, E | E1, R | R1>
70
- }),
71
- )
50
+ ),
51
+ Effect.forever,
52
+ Effect.raceFirst(Deferred.await(deferred)),
53
+ )
54
+ })
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "0.105.0";
1
+ export const LIB_VERSION = "0.107.0";
@@ -1 +1 @@
1
- {"fileNames":[],"fileInfos":[],"root":[],"options":{"allowJs":false,"checkJs":false,"composite":true,"declaration":true,"declarationMap":true,"downlevelIteration":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":7,"noEmitOnError":false,"noErrorTruncation":false,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":false,"noImplicitThis":true,"noUncheckedIndexedAccess":false,"noUnusedLocals":true,"noUnusedParameters":false,"removeComments":false,"skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"stripInternal":true,"target":99},"version":"5.6.3"}
1
+ {"fileNames":[],"fileInfos":[],"root":[],"options":{"allowJs":false,"checkJs":false,"composite":true,"declaration":true,"declarationMap":true,"downlevelIteration":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":7,"noEmitOnError":false,"noErrorTruncation":false,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":false,"noImplicitThis":true,"noUncheckedIndexedAccess":false,"noUnusedLocals":true,"noUnusedParameters":false,"removeComments":false,"skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"stripInternal":true,"target":99},"version":"5.7.2"}