@forge/storage 1.7.3 → 1.8.0-next.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.
@@ -692,47 +692,6 @@ describe.each([
692
692
  ? checkMetricsFired(metricMocks, { store: 'untyped', operation: 'query', encrypted: false }, true)
693
693
  : expect(metricMocks.mockMetrics.counter).not.toHaveBeenCalled();
694
694
  });
695
- it('should query the appStoredEntitiesForCleanup endpoint given process.env.IS_CLEANUP_FUNCTION is set to true', async () => {
696
- process.env.IS_CLEANUP_FUNCTION = 'true';
697
- const apiClientMock = getApiClientMock({
698
- data: {
699
- appStoredEntitiesForCleanup: {
700
- edges: [
701
- { node: { key: 'key1', value: 'testValue' }, cursor: 'cursor1' },
702
- { node: { key: 'key2', value: 'testValue' }, cursor: 'cursor2' }
703
- ]
704
- }
705
- }
706
- });
707
- const metricMocks = getMetricMock();
708
- const globalStorage = getStorage(apiClientMock, passMetrics ? metricMocks.mockMetrics : undefined);
709
- const where = [
710
- {
711
- field: 'key',
712
- condition: 'STARTS_WITH',
713
- value: 'test'
714
- }
715
- ];
716
- const cursor = 'cursor';
717
- const limit = 10;
718
- const response = await globalStorage.list({ where, cursor, limit });
719
- verifyApiClientCalledWith(apiClientMock, {
720
- where,
721
- cursor,
722
- limit
723
- }, gql_queries_1.UntypedQueries.listQueryForCleanup({}).query);
724
- expect(response).toEqual(expect.objectContaining({
725
- results: [
726
- { key: 'key1', value: 'testValue' },
727
- { key: 'key2', value: 'testValue' }
728
- ],
729
- nextCursor: 'cursor2'
730
- }));
731
- passMetrics
732
- ? checkMetricsFired(metricMocks, { store: 'untyped', operation: 'query', encrypted: false }, true)
733
- : expect(metricMocks.mockMetrics.counter).not.toHaveBeenCalled();
734
- process.env.IS_CLEANUP_FUNCTION = '';
735
- });
736
695
  it('should use default values', async () => {
737
696
  const apiClientMock = getApiClientMock({
738
697
  data: {
@@ -1 +1 @@
1
- {"version":3,"file":"global-storage.d.ts","sourceRoot":"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- ? gql_queries_1.UntypedQueries.listQueryForCleanup(options)
44
- : gql_queries_1.UntypedQueries.listQuery(options);
42
+ const requestBody = gql_queries_1.UntypedQueries.listQuery(options);
45
43
  const response = await this.wrapInMetric('untyped', 'query', false, async () => await this.query(requestBody));
46
- const edges = process.env.IS_CLEANUP_FUNCTION === 'true'
47
- ? response.appStoredEntitiesForCleanup.edges
48
- : response.appStoredEntities.edges;
44
+ const edges = response.appStoredEntities.edges;
49
45
  const nextCursor = edges.length > 0 ? edges[edges.length - 1].cursor : undefined;
50
46
  const results = edges.map(({ node }) => node);
51
47
  return {
@@ -34,14 +34,6 @@ export declare class UntypedQueries {
34
34
  limit: number | null;
35
35
  };
36
36
  };
37
- static listQueryForCleanup: (options: ListOptions) => {
38
- query: string;
39
- variables: {
40
- where: import("./query-interfaces").WhereClause[] | null;
41
- cursor: string | null;
42
- limit: number | null;
43
- };
44
- };
45
37
  }
46
38
  export declare class CustomEntityQueries {
47
39
  static get: (entityName: string, key: string) => {
@@ -1 +1 @@
1
- {"version":3,"file":"gql-queries.d.ts","sourceRoot":"","sources":["../src/gql-queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1E,qBAAa,cAAc;IACzB,OAAc,GAAG,QAAS,MAAM,aAAa,OAAO;;;;;;MAajD;IAEH,OAAc,GAAG,QAAS,MAAM,SAAS,GAAG,aAAa,OAAO;;;;;;;;;MAyB7D;IAEH,OAAc,MAAM,QAAS,MAAM,aAAa,OAAO;;;;;;;;MAwBpD;IAEH,OAAc,SAAS,YAAa,WAAW;;;;;;;MAqB5C;IAEH,OAAc,mBAAmB,YAAa,WAAW;;;;;;;MAqBtD;CACJ;AAED,qBAAa,mBAAmB;IAC9B,OAAc,GAAG,eAAgB,MAAM,OAAO,MAAM;;;;;;MAcjD;IAEH,OAAc,GAAG,eAAgB,MAAM,OAAO,MAAM,SAAS,GAAG;;;;;;;;;MAyB7D;IAEH,OAAc,MAAM,eAAgB,MAAM,OAAO,MAAM;;;;;;;;MAwBpD;IAEH,OAAc,SAAS,YAAa,uBAAuB;;;;;;;;;;;;;;MAsCzD;CACH"}
1
+ {"version":3,"file":"gql-queries.d.ts","sourceRoot":"","sources":["../src/gql-queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1E,qBAAa,cAAc;IACzB,OAAc,GAAG,QAAS,MAAM,aAAa,OAAO;;;;;;MAajD;IAEH,OAAc,GAAG,QAAS,MAAM,SAAS,GAAG,aAAa,OAAO;;;;;;;;;MAyB7D;IAEH,OAAc,MAAM,QAAS,MAAM,aAAa,OAAO;;;;;;;;MAwBpD;IAEH,OAAc,SAAS,YAAa,WAAW;;;;;;;MAqB5C;CACJ;AAED,qBAAa,mBAAmB;IAC9B,OAAc,GAAG,eAAgB,MAAM,OAAO,MAAM;;;;;;MAcjD;IAEH,OAAc,GAAG,eAAgB,MAAM,OAAO,MAAM,SAAS,GAAG;;;;;;;;;MAyB7D;IAEH,OAAc,MAAM,eAAgB,MAAM,OAAO,MAAM;;;;;;;;MAwBpD;IAEH,OAAc,SAAS,YAAa,uBAAuB;;;;;;;;;;;;;;MAsCzD;CACH"}
@@ -88,27 +88,6 @@ class UntypedQueries {
88
88
  limit: options.limit ?? null
89
89
  }
90
90
  });
91
- static listQueryForCleanup = (options) => ({
92
- query: `
93
- query forge_app_getApplicationStorageEntitiesForCleanup($where: [AppStoredEntityFilter!], $cursor: String, $limit: Int) {
94
- appStoredEntitiesForCleanup(where: $where, after: $cursor, first: $limit) {
95
- edges {
96
- node {
97
- value
98
- key
99
- }
100
-
101
- cursor
102
- }
103
- }
104
- }
105
- `,
106
- variables: {
107
- where: options.where ?? null,
108
- cursor: options.cursor ?? null,
109
- limit: options.limit ?? null
110
- }
111
- });
112
91
  }
113
92
  exports.UntypedQueries = UntypedQueries;
114
93
  class CustomEntityQueries {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/storage",
3
- "version": "1.7.3",
3
+ "version": "1.8.0-next.0",
4
4
  "description": "Forge Storage methods",
5
5
  "author": "Atlassian",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",