eas-cli 3.17.0 → 3.17.1

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.
@@ -400,20 +400,14 @@ export type AccountQueryByNameArgs = {
400
400
  /** Auth configuration data for an SSO account. */
401
401
  export type AccountSsoConfiguration = {
402
402
  __typename?: 'AccountSSOConfiguration';
403
- authEndpoint?: Maybe<Scalars['String']>;
404
403
  authProtocol: AuthProtocolType;
405
404
  authProviderIdentifier: Scalars['String'];
406
405
  clientIdentifier: Scalars['String'];
407
406
  clientSecret: Scalars['String'];
408
407
  createdAt: Scalars['DateTime'];
409
- endSessionEndpoint?: Maybe<Scalars['String']>;
410
408
  id: Scalars['ID'];
411
409
  issuer: Scalars['String'];
412
- jwksEndpoint?: Maybe<Scalars['String']>;
413
- revokeEndpoint?: Maybe<Scalars['String']>;
414
- tokenEndpoint?: Maybe<Scalars['String']>;
415
410
  updatedAt: Scalars['DateTime'];
416
- userInfoEndpoint?: Maybe<Scalars['String']>;
417
411
  };
418
412
  export type AccountSsoConfigurationData = {
419
413
  authEndpoint?: InputMaybe<Scalars['String']>;
@@ -451,17 +445,11 @@ export type AccountSsoConfigurationMutationUpdateAccountSsoConfigurationArgs = {
451
445
  /** Public auth configuration data for an SSO account. */
452
446
  export type AccountSsoConfigurationPublicData = {
453
447
  __typename?: 'AccountSSOConfigurationPublicData';
454
- authEndpoint?: Maybe<Scalars['String']>;
455
448
  authProtocol: AuthProtocolType;
456
449
  authProviderIdentifier: Scalars['String'];
457
- clientIdentifier: Scalars['String'];
458
- endSessionEndpoint?: Maybe<Scalars['String']>;
450
+ authorizationUrl: Scalars['String'];
459
451
  id: Scalars['ID'];
460
452
  issuer: Scalars['String'];
461
- jwksEndpoint?: Maybe<Scalars['String']>;
462
- revokeEndpoint?: Maybe<Scalars['String']>;
463
- tokenEndpoint?: Maybe<Scalars['String']>;
464
- userInfoEndpoint?: Maybe<Scalars['String']>;
465
453
  };
466
454
  export type AccountSsoConfigurationPublicDataQuery = {
467
455
  __typename?: 'AccountSSOConfigurationPublicDataQuery';
@@ -1885,6 +1873,15 @@ export declare enum BuildJobStatus {
1885
1873
  SentToQueue = "SENT_TO_QUEUE",
1886
1874
  Started = "STARTED"
1887
1875
  }
1876
+ export type BuildLimitThresholdExceededMetadata = {
1877
+ __typename?: 'BuildLimitThresholdExceededMetadata';
1878
+ account: Account;
1879
+ thresholdsExceeded: Array<NotificationThresholdExceeded>;
1880
+ };
1881
+ export declare enum BuildLimitThresholdExceededMetadataType {
1882
+ Ios = "IOS",
1883
+ Total = "TOTAL"
1884
+ }
1888
1885
  export type BuildLogs = {
1889
1886
  __typename?: 'BuildLogs';
1890
1887
  format?: Maybe<BuildJobLogsFormat>;
@@ -2004,6 +2001,13 @@ export type BuildParamsInput = {
2004
2001
  resourceClass: BuildResourceClass;
2005
2002
  sdkVersion?: InputMaybe<Scalars['String']>;
2006
2003
  };
2004
+ export type BuildPlanCreditThresholdExceededMetadata = {
2005
+ __typename?: 'BuildPlanCreditThresholdExceededMetadata';
2006
+ account: Account;
2007
+ buildCreditUsage: Scalars['Int'];
2008
+ planLimit: Scalars['Int'];
2009
+ threshold: Scalars['Int'];
2010
+ };
2007
2011
  export declare enum BuildPriority {
2008
2012
  High = "HIGH",
2009
2013
  Normal = "NORMAL",
@@ -3133,12 +3137,23 @@ export type MeteredBillingStatus = {
3133
3137
  EAS_BUILD: Scalars['Boolean'];
3134
3138
  EAS_UPDATE: Scalars['Boolean'];
3135
3139
  };
3140
+ export type Notification = {
3141
+ __typename?: 'Notification';
3142
+ createdAt: Scalars['DateTime'];
3143
+ event: NotificationEvent;
3144
+ id: Scalars['ID'];
3145
+ metadata?: Maybe<NotificationMetadata>;
3146
+ type: NotificationType;
3147
+ updatedAt: Scalars['DateTime'];
3148
+ };
3136
3149
  export declare enum NotificationEvent {
3137
3150
  BuildComplete = "BUILD_COMPLETE",
3138
3151
  BuildLimitThresholdExceeded = "BUILD_LIMIT_THRESHOLD_EXCEEDED",
3139
3152
  BuildPlanCreditThresholdExceeded = "BUILD_PLAN_CREDIT_THRESHOLD_EXCEEDED",
3140
- SubmissionComplete = "SUBMISSION_COMPLETE"
3153
+ SubmissionComplete = "SUBMISSION_COMPLETE",
3154
+ Test = "TEST"
3141
3155
  }
3156
+ export type NotificationMetadata = BuildLimitThresholdExceededMetadata | BuildPlanCreditThresholdExceededMetadata | TestNotificationMetadata;
3142
3157
  export type NotificationSubscription = {
3143
3158
  __typename?: 'NotificationSubscription';
3144
3159
  account?: Maybe<Account>;
@@ -3170,8 +3185,16 @@ export type NotificationSubscriptionMutationSubscribeToEventForAppArgs = {
3170
3185
  export type NotificationSubscriptionMutationUnsubscribeArgs = {
3171
3186
  id: Scalars['ID'];
3172
3187
  };
3188
+ export type NotificationThresholdExceeded = {
3189
+ __typename?: 'NotificationThresholdExceeded';
3190
+ count: Scalars['Int'];
3191
+ limit: Scalars['Int'];
3192
+ threshold: Scalars['Int'];
3193
+ type: BuildLimitThresholdExceededMetadataType;
3194
+ };
3173
3195
  export declare enum NotificationType {
3174
- Email = "EMAIL"
3196
+ Email = "EMAIL",
3197
+ Web = "WEB"
3175
3198
  }
3176
3199
  export type Offer = {
3177
3200
  __typename?: 'Offer';
@@ -3616,6 +3639,8 @@ export type SsoUser = Actor & UserActor & {
3616
3639
  /** @deprecated No longer supported */
3617
3640
  twitterUsername?: Maybe<Scalars['String']>;
3618
3641
  username: Scalars['String'];
3642
+ /** Web notifications linked to a user */
3643
+ webNotifications: Array<Notification>;
3619
3644
  };
3620
3645
  /** Represents a human SSO (not robot) actor. */
3621
3646
  export type SsoUserActivityTimelineProjectActivitiesArgs = {
@@ -3980,6 +4005,10 @@ export type SubscriptionDetails = {
3980
4005
  export type SubscriptionDetailsPlanEnablementArgs = {
3981
4006
  serviceMetric: EasServiceMetric;
3982
4007
  };
4008
+ export type TestNotificationMetadata = {
4009
+ __typename?: 'TestNotificationMetadata';
4010
+ message: Scalars['String'];
4011
+ };
3983
4012
  export type TimelineActivityConnection = {
3984
4013
  __typename?: 'TimelineActivityConnection';
3985
4014
  edges: Array<TimelineActivityEdge>;
@@ -4250,6 +4279,7 @@ export type User = Actor & UserActor & {
4250
4279
  /** @deprecated No longer supported */
4251
4280
  twitterUsername?: Maybe<Scalars['String']>;
4252
4281
  username: Scalars['String'];
4282
+ webNotifications: Array<Notification>;
4253
4283
  };
4254
4284
  /** Represents a human (not robot) actor. */
4255
4285
  export type UserActivityTimelineProjectActivitiesArgs = {
@@ -4327,6 +4357,8 @@ export type UserActor = {
4327
4357
  /** @deprecated No longer supported */
4328
4358
  twitterUsername?: Maybe<Scalars['String']>;
4329
4359
  username: Scalars['String'];
4360
+ /** Web notifications linked to a user */
4361
+ webNotifications: Array<Notification>;
4330
4362
  };
4331
4363
  /** A human user (type User or SSOUser) that can login to the Expo website, use Expo services, and be a member of accounts. */
4332
4364
  export type UserActorActivityTimelineProjectActivitiesArgs = {
@@ -8733,6 +8765,7 @@ export type ViewBuildsOnAppQuery = {
8733
8765
  export type ViewUpdateChannelOnAppQueryVariables = Exact<{
8734
8766
  appId: Scalars['String'];
8735
8767
  channelName: Scalars['String'];
8768
+ filter?: InputMaybe<UpdatesFilter>;
8736
8769
  }>;
8737
8770
  export type ViewUpdateChannelOnAppQuery = {
8738
8771
  __typename?: 'RootQuery';
@@ -8809,6 +8842,7 @@ export type ViewUpdateChannelsOnAppQuery = {
8809
8842
  __typename?: 'UpdateChannel';
8810
8843
  id: string;
8811
8844
  name: string;
8845
+ createdAt: any;
8812
8846
  branchMapping: string;
8813
8847
  updateBranches: Array<{
8814
8848
  __typename?: 'UpdateBranch';
@@ -8856,6 +8890,40 @@ export type ViewUpdateChannelsOnAppQuery = {
8856
8890
  };
8857
8891
  };
8858
8892
  };
8893
+ export type ViewUpdateChannelsPaginatedOnAppQueryVariables = Exact<{
8894
+ appId: Scalars['String'];
8895
+ first?: InputMaybe<Scalars['Int']>;
8896
+ after?: InputMaybe<Scalars['String']>;
8897
+ }>;
8898
+ export type ViewUpdateChannelsPaginatedOnAppQuery = {
8899
+ __typename?: 'RootQuery';
8900
+ app: {
8901
+ __typename?: 'AppQuery';
8902
+ byId: {
8903
+ __typename?: 'App';
8904
+ id: string;
8905
+ channelsPaginated: {
8906
+ __typename?: 'AppChannelsConnection';
8907
+ edges: Array<{
8908
+ __typename?: 'AppChannelEdge';
8909
+ node: {
8910
+ __typename?: 'UpdateChannel';
8911
+ id: string;
8912
+ name: string;
8913
+ branchMapping: string;
8914
+ };
8915
+ }>;
8916
+ pageInfo: {
8917
+ __typename?: 'PageInfo';
8918
+ hasNextPage: boolean;
8919
+ hasPreviousPage: boolean;
8920
+ startCursor?: string | null;
8921
+ endCursor?: string | null;
8922
+ };
8923
+ };
8924
+ };
8925
+ };
8926
+ };
8859
8927
  export type EnvironmentSecretsByAppIdQueryVariables = Exact<{
8860
8928
  appId: Scalars['String'];
8861
8929
  }>;
@@ -9697,6 +9765,12 @@ export type UpdateBranchFragment = {
9697
9765
  } | null;
9698
9766
  }>;
9699
9767
  };
9768
+ export type UpdateChannelBasicInfoFragment = {
9769
+ __typename?: 'UpdateChannel';
9770
+ id: string;
9771
+ name: string;
9772
+ branchMapping: string;
9773
+ };
9700
9774
  export type WebhookFragment = {
9701
9775
  __typename?: 'Webhook';
9702
9776
  id: string;
@@ -6,8 +6,8 @@
6
6
  * For more info and docs, visit https://graphql-code-generator.com/
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.Role = exports.ProjectArchiveSourceType = exports.Permission = exports.Order = exports.OfferType = exports.NotificationType = exports.NotificationEvent = exports.MailchimpTag = exports.MailchimpAudience = exports.IosSchemeBuildConfiguration = exports.IosManagedBuildType = exports.IosDistributionType = exports.IosBuildType = exports.InvoiceDiscountType = exports.GitHubAppInstallationStatus = exports.GitHubAppEnvironment = exports.Feature = exports.EnvironmentSecretType = exports.EasTotalPlanEnablementUnit = exports.EasServiceMetric = exports.EasService = exports.EasBuildDeprecationInfoType = exports.EasBuildBillingResourceClass = exports.DistributionType = exports.BuildWorkflow = exports.BuildTrigger = exports.BuildStatus = exports.BuildRetryDisabledReason = exports.BuildResourceClass = exports.BuildPriority = exports.BuildMode = exports.BuildJobStatus = exports.BuildJobLogsFormat = exports.BuildIosEnterpriseProvisioning = exports.BuildCredentialsSource = exports.BackgroundJobState = exports.BackgroundJobResultType = exports.AuthProtocolType = exports.AssetMetadataStatus = exports.AppsFilter = exports.AppleDeviceClass = exports.AppStoreConnectUserRole = exports.AppSort = exports.AppPrivacy = exports.AppPlatform = exports.AndroidKeystoreType = exports.AndroidFcmVersion = exports.AndroidBuildType = exports.ActivityTimelineProjectActivityType = exports.AccountAppsSortByField = void 0;
10
- exports.WebhookType = exports.UsageMetricsGranularity = exports.UsageMetricType = exports.UploadSessionType = exports.SubmissionStatus = exports.SubmissionArchiveSourceType = exports.SubmissionAndroidTrack = exports.SubmissionAndroidReleaseStatus = exports.SubmissionAndroidArchiveType = exports.StatuspageServiceStatus = exports.StatuspageServiceName = exports.StatuspageIncidentStatus = exports.StatuspageIncidentImpact = exports.StandardOffer = exports.SecondFactorMethod = void 0;
9
+ exports.ProjectArchiveSourceType = exports.Permission = exports.Order = exports.OfferType = exports.NotificationType = exports.NotificationEvent = exports.MailchimpTag = exports.MailchimpAudience = exports.IosSchemeBuildConfiguration = exports.IosManagedBuildType = exports.IosDistributionType = exports.IosBuildType = exports.InvoiceDiscountType = exports.GitHubAppInstallationStatus = exports.GitHubAppEnvironment = exports.Feature = exports.EnvironmentSecretType = exports.EasTotalPlanEnablementUnit = exports.EasServiceMetric = exports.EasService = exports.EasBuildDeprecationInfoType = exports.EasBuildBillingResourceClass = exports.DistributionType = exports.BuildWorkflow = exports.BuildTrigger = exports.BuildStatus = exports.BuildRetryDisabledReason = exports.BuildResourceClass = exports.BuildPriority = exports.BuildMode = exports.BuildLimitThresholdExceededMetadataType = exports.BuildJobStatus = exports.BuildJobLogsFormat = exports.BuildIosEnterpriseProvisioning = exports.BuildCredentialsSource = exports.BackgroundJobState = exports.BackgroundJobResultType = exports.AuthProtocolType = exports.AssetMetadataStatus = exports.AppsFilter = exports.AppleDeviceClass = exports.AppStoreConnectUserRole = exports.AppSort = exports.AppPrivacy = exports.AppPlatform = exports.AndroidKeystoreType = exports.AndroidFcmVersion = exports.AndroidBuildType = exports.ActivityTimelineProjectActivityType = exports.AccountAppsSortByField = void 0;
10
+ exports.WebhookType = exports.UsageMetricsGranularity = exports.UsageMetricType = exports.UploadSessionType = exports.SubmissionStatus = exports.SubmissionArchiveSourceType = exports.SubmissionAndroidTrack = exports.SubmissionAndroidReleaseStatus = exports.SubmissionAndroidArchiveType = exports.StatuspageServiceStatus = exports.StatuspageServiceName = exports.StatuspageIncidentStatus = exports.StatuspageIncidentImpact = exports.StandardOffer = exports.SecondFactorMethod = exports.Role = void 0;
11
11
  var AccountAppsSortByField;
12
12
  (function (AccountAppsSortByField) {
13
13
  AccountAppsSortByField["LatestActivityTime"] = "LATEST_ACTIVITY_TIME";
@@ -136,6 +136,11 @@ var BuildJobStatus;
136
136
  BuildJobStatus["SentToQueue"] = "SENT_TO_QUEUE";
137
137
  BuildJobStatus["Started"] = "STARTED";
138
138
  })(BuildJobStatus = exports.BuildJobStatus || (exports.BuildJobStatus = {}));
139
+ var BuildLimitThresholdExceededMetadataType;
140
+ (function (BuildLimitThresholdExceededMetadataType) {
141
+ BuildLimitThresholdExceededMetadataType["Ios"] = "IOS";
142
+ BuildLimitThresholdExceededMetadataType["Total"] = "TOTAL";
143
+ })(BuildLimitThresholdExceededMetadataType = exports.BuildLimitThresholdExceededMetadataType || (exports.BuildLimitThresholdExceededMetadataType = {}));
139
144
  var BuildMode;
140
145
  (function (BuildMode) {
141
146
  BuildMode["Build"] = "BUILD";
@@ -306,10 +311,12 @@ var NotificationEvent;
306
311
  NotificationEvent["BuildLimitThresholdExceeded"] = "BUILD_LIMIT_THRESHOLD_EXCEEDED";
307
312
  NotificationEvent["BuildPlanCreditThresholdExceeded"] = "BUILD_PLAN_CREDIT_THRESHOLD_EXCEEDED";
308
313
  NotificationEvent["SubmissionComplete"] = "SUBMISSION_COMPLETE";
314
+ NotificationEvent["Test"] = "TEST";
309
315
  })(NotificationEvent = exports.NotificationEvent || (exports.NotificationEvent = {}));
310
316
  var NotificationType;
311
317
  (function (NotificationType) {
312
318
  NotificationType["Email"] = "EMAIL";
319
+ NotificationType["Web"] = "WEB";
313
320
  })(NotificationType = exports.NotificationType || (exports.NotificationType = {}));
314
321
  var OfferType;
315
322
  (function (OfferType) {
@@ -1,8 +1,12 @@
1
1
  import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
2
- import { ViewUpdateChannelOnAppQuery, ViewUpdateChannelOnAppQueryVariables, ViewUpdateChannelsOnAppQuery, ViewUpdateChannelsOnAppQueryVariables } from '../generated';
3
- export type UpdateChannelObject = NonNullable<ViewUpdateChannelsOnAppQuery['app']['byId']['updateChannels']>[number];
4
- export type UpdateChannelByNameObject = NonNullable<ViewUpdateChannelOnAppQuery['app']['byId']['updateChannelByName']>;
2
+ import { ViewUpdateChannelOnAppQuery, ViewUpdateChannelOnAppQueryVariables, ViewUpdateChannelsOnAppQuery, ViewUpdateChannelsOnAppQueryVariables, ViewUpdateChannelsPaginatedOnAppQuery, ViewUpdateChannelsPaginatedOnAppQueryVariables } from '../generated';
3
+ type ViewUpdateChannelsOnAppObject = NonNullable<ViewUpdateChannelsOnAppQuery['app']['byId']['updateChannels']>[number];
4
+ type UpdateChannelByNameObject = NonNullable<ViewUpdateChannelOnAppQuery['app']['byId']['updateChannelByName']>;
5
+ export type UpdateChannelObject = ViewUpdateChannelsOnAppObject & UpdateChannelByNameObject;
6
+ export type UpdateBranchObject = UpdateChannelObject['updateBranches'][number];
5
7
  export declare const ChannelQuery: {
6
- viewUpdateChannelAsync(graphqlClient: ExpoGraphqlClient, { appId, channelName }: ViewUpdateChannelOnAppQueryVariables): Promise<UpdateChannelByNameObject>;
8
+ viewUpdateChannelAsync(graphqlClient: ExpoGraphqlClient, { appId, channelName, filter }: ViewUpdateChannelOnAppQueryVariables): Promise<UpdateChannelByNameObject>;
7
9
  viewUpdateChannelsOnAppAsync(graphqlClient: ExpoGraphqlClient, { appId, limit, offset }: ViewUpdateChannelsOnAppQueryVariables): Promise<UpdateChannelObject[]>;
10
+ viewUpdateChannelsBasicInfoPaginatedOnAppAsync(graphqlClient: ExpoGraphqlClient, { appId, first, after }: ViewUpdateChannelsPaginatedOnAppQueryVariables): Promise<ViewUpdateChannelsPaginatedOnAppQuery['app']['byId']['channelsPaginated']>;
8
11
  };
12
+ export {};
@@ -7,11 +7,16 @@ const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
7
7
  const errors_1 = require("../../channel/errors");
8
8
  const client_1 = require("../client");
9
9
  const Update_1 = require("../types/Update");
10
+ const UpdateChannelBasicInfo_1 = require("../types/UpdateChannelBasicInfo");
10
11
  exports.ChannelQuery = {
11
- async viewUpdateChannelAsync(graphqlClient, { appId, channelName }) {
12
+ async viewUpdateChannelAsync(graphqlClient, { appId, channelName, filter }) {
12
13
  const response = await (0, client_1.withErrorHandlingAsync)(graphqlClient
13
14
  .query((0, graphql_tag_1.default) `
14
- query ViewUpdateChannelOnApp($appId: String!, $channelName: String!) {
15
+ query ViewUpdateChannelOnApp(
16
+ $appId: String!
17
+ $channelName: String!
18
+ $filter: UpdatesFilter
19
+ ) {
15
20
  app {
16
21
  byId(appId: $appId) {
17
22
  id
@@ -23,7 +28,7 @@ exports.ChannelQuery = {
23
28
  updateBranches(offset: 0, limit: 5) {
24
29
  id
25
30
  name
26
- updateGroups(offset: 0, limit: 1) {
31
+ updateGroups(offset: 0, limit: 1, filter: $filter) {
27
32
  id
28
33
  ...UpdateFragment
29
34
  }
@@ -33,7 +38,7 @@ exports.ChannelQuery = {
33
38
  }
34
39
  }
35
40
  ${(0, graphql_1.print)(Update_1.UpdateFragmentNode)}
36
- `, { appId, channelName }, { additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] })
41
+ `, { appId, channelName, filter }, { additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] })
37
42
  .toPromise());
38
43
  const { updateChannelByName } = response.app.byId;
39
44
  if (!updateChannelByName) {
@@ -51,6 +56,7 @@ exports.ChannelQuery = {
51
56
  updateChannels(offset: $offset, limit: $limit) {
52
57
  id
53
58
  name
59
+ createdAt
54
60
  branchMapping
55
61
  updateBranches(offset: 0, limit: 5) {
56
62
  id
@@ -73,4 +79,37 @@ exports.ChannelQuery = {
73
79
  }
74
80
  return updateChannels;
75
81
  },
82
+ async viewUpdateChannelsBasicInfoPaginatedOnAppAsync(graphqlClient, { appId, first, after }) {
83
+ const response = await (0, client_1.withErrorHandlingAsync)(graphqlClient
84
+ .query((0, graphql_tag_1.default) `
85
+ query ViewUpdateChannelsPaginatedOnApp($appId: String!, $first: Int, $after: String) {
86
+ app {
87
+ byId(appId: $appId) {
88
+ id
89
+ channelsPaginated(first: $first, after: $after) {
90
+ edges {
91
+ node {
92
+ id
93
+ ...UpdateChannelBasicInfoFragment
94
+ }
95
+ }
96
+ pageInfo {
97
+ hasNextPage
98
+ hasPreviousPage
99
+ startCursor
100
+ endCursor
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ ${(0, graphql_1.print)(UpdateChannelBasicInfo_1.UpdateChannelBasicInfoFragmentNode)}
107
+ `, { appId, first, after }, { additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] })
108
+ .toPromise());
109
+ const { channelsPaginated } = response.app.byId;
110
+ if (!channelsPaginated) {
111
+ throw new Error(`Could not find channels on project with id ${appId}`);
112
+ }
113
+ return channelsPaginated;
114
+ },
76
115
  };
@@ -0,0 +1 @@
1
+ export declare const UpdateChannelBasicInfoFragmentNode: import("graphql").DocumentNode;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateChannelBasicInfoFragmentNode = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
6
+ exports.UpdateChannelBasicInfoFragmentNode = (0, graphql_tag_1.default) `
7
+ fragment UpdateChannelBasicInfoFragment on UpdateChannel {
8
+ id
9
+ name
10
+ branchMapping
11
+ }
12
+ `;
@@ -0,0 +1,33 @@
1
+ import { PageInfo } from '../graphql/generated';
2
+ export type Connection<T> = {
3
+ edges: Edge<T>[];
4
+ pageInfo: PageInfo;
5
+ };
6
+ type Edge<T> = {
7
+ node: T;
8
+ };
9
+ export type QueryParams = {
10
+ first: number;
11
+ after?: string;
12
+ };
13
+ /**
14
+ * Fetches dataset in paginated manner (batch by batch) using GraphQL queries.
15
+ *
16
+ * @param queryAsync A promise based function for querying.
17
+ * @param beforeEachQuery Optional. A callback function to be called before each query
18
+ * @param afterEachQuery Optional. A callback function to be called after each query.
19
+ * @param filterPredicate Optional. A predicate function to filter the node.
20
+ * @param batchSize Optional. The batch size of the pagination. Defaults to 100.
21
+ *
22
+ * @return {Promise<T[]>} - A promise that resolves to an array (the dataset).
23
+ * @throws {Error} - If an error occurs during execution of the query or pagination.
24
+ */
25
+ export declare function getPaginatedDatasetAsync<T>({ queryAsync, beforeEachQuery, afterEachQuery, filterPredicate, batchSize, maxNodesFetched, }: {
26
+ queryAsync: ({ first, after }: QueryParams) => Promise<Connection<T>>;
27
+ beforeEachQuery?: (totalNodesFetched: number, dataset: T[]) => void;
28
+ afterEachQuery?: (totalNodesFetched: number, dataset: T[], batch: T[], pageInfo: PageInfo) => void;
29
+ filterPredicate?: (node: T) => boolean;
30
+ batchSize?: number;
31
+ maxNodesFetched?: number;
32
+ }): Promise<T[]>;
33
+ export {};
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPaginatedDatasetAsync = void 0;
4
+ /**
5
+ * Fetches dataset in paginated manner (batch by batch) using GraphQL queries.
6
+ *
7
+ * @param queryAsync A promise based function for querying.
8
+ * @param beforeEachQuery Optional. A callback function to be called before each query
9
+ * @param afterEachQuery Optional. A callback function to be called after each query.
10
+ * @param filterPredicate Optional. A predicate function to filter the node.
11
+ * @param batchSize Optional. The batch size of the pagination. Defaults to 100.
12
+ *
13
+ * @return {Promise<T[]>} - A promise that resolves to an array (the dataset).
14
+ * @throws {Error} - If an error occurs during execution of the query or pagination.
15
+ */
16
+ async function getPaginatedDatasetAsync({ queryAsync, beforeEachQuery, afterEachQuery, filterPredicate, batchSize = 100, maxNodesFetched = 10000, }) {
17
+ var _a;
18
+ const dataset = [];
19
+ let hasMore = true;
20
+ let after;
21
+ let totalNodesFetched = 0;
22
+ while (hasMore) {
23
+ if (beforeEachQuery) {
24
+ beforeEachQuery(totalNodesFetched, dataset);
25
+ }
26
+ const result = await queryAsync({ first: batchSize, after });
27
+ const { edges, pageInfo } = result;
28
+ const nodes = edges.map(edge => edge.node);
29
+ const batch = filterPredicate ? nodes.filter(filterPredicate) : nodes;
30
+ dataset.push(...batch);
31
+ hasMore = pageInfo.hasNextPage;
32
+ after = (_a = pageInfo.endCursor) !== null && _a !== void 0 ? _a : undefined;
33
+ totalNodesFetched += nodes.length;
34
+ if (afterEachQuery) {
35
+ afterEachQuery(totalNodesFetched, dataset, batch, pageInfo);
36
+ }
37
+ if (totalNodesFetched >= maxNodesFetched) {
38
+ return dataset;
39
+ }
40
+ }
41
+ return dataset;
42
+ }
43
+ exports.getPaginatedDatasetAsync = getPaginatedDatasetAsync;