@forge/storage 1.1.0 → 1.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @forge/storage
2
2
 
3
+ ## 1.2.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 21e392d: Added new filters for Early Access Program
8
+
3
9
  ## 1.1.0
4
10
 
5
11
  ### Minor Changes
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const query_api_1 = require("../query-api");
4
4
  const conditions_1 = require("../conditions");
5
+ const conditions_2 = require("../eap/conditions");
5
6
  describe('DefaultQueryBuilder', () => {
6
7
  function newGlobalStorage() {
7
8
  return {
@@ -48,6 +49,45 @@ describe('DefaultQueryBuilder', () => {
48
49
  cursor: 'cursor'
49
50
  }));
50
51
  });
52
+ it('should allow specifying a "starts with" condition', async () => {
53
+ const globalStorage = newGlobalStorage();
54
+ await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_1.startsWith('test')).getMany();
55
+ expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
56
+ where: [
57
+ {
58
+ field: 'key',
59
+ condition: 'STARTS_WITH',
60
+ value: 'test'
61
+ }
62
+ ]
63
+ }));
64
+ });
65
+ it('should allow specifying a "not equal to" condition', async () => {
66
+ const globalStorage = newGlobalStorage();
67
+ await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_2.notEqualTo(['test', 'test2'])).getMany();
68
+ expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
69
+ where: [
70
+ {
71
+ field: 'key',
72
+ condition: 'NOT_EQUAL_TO',
73
+ value: ['test', 'test2']
74
+ }
75
+ ]
76
+ }));
77
+ });
78
+ it('should allow specifying an "is in" condition', async () => {
79
+ const globalStorage = newGlobalStorage();
80
+ await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_2.isIn(['test', 'test2'])).getMany();
81
+ expect(globalStorage.list).toHaveBeenCalledWith(expect.objectContaining({
82
+ where: [
83
+ {
84
+ field: 'key',
85
+ condition: 'IN',
86
+ value: ['test', 'test2']
87
+ }
88
+ ]
89
+ }));
90
+ });
51
91
  it('should allow specifying a condition', async () => {
52
92
  const globalStorage = newGlobalStorage();
53
93
  await new query_api_1.DefaultQueryBuilder(globalStorage).where('key', conditions_1.startsWith('test')).getMany();
@@ -0,0 +1,4 @@
1
+ import { Predicate } from '../storage-adapter';
2
+ export declare function notEqualTo(value: string[]): Predicate;
3
+ export declare function isIn(values: string[]): Predicate;
4
+ //# sourceMappingURL=conditions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../src/eap/conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,SAAS,CAKrD;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAKhD"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIn = exports.notEqualTo = void 0;
4
+ function notEqualTo(value) {
5
+ return {
6
+ condition: 'NOT_EQUAL_TO',
7
+ value
8
+ };
9
+ }
10
+ exports.notEqualTo = notEqualTo;
11
+ function isIn(values) {
12
+ return {
13
+ condition: 'IN',
14
+ value: values
15
+ };
16
+ }
17
+ exports.isIn = isIn;
@@ -0,0 +1,2 @@
1
+ export * from './conditions';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/eap/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./conditions"), exports);
package/out/queries.d.ts CHANGED
@@ -6,11 +6,22 @@ export declare const getQuery: (contextAri: string, key: string, encrypted: bool
6
6
  encrypted: boolean;
7
7
  };
8
8
  };
9
- export interface WhereClause {
9
+ export interface StartsWithClause {
10
10
  field: string;
11
11
  condition: 'STARTS_WITH';
12
12
  value: string;
13
13
  }
14
+ export interface NotEqualToClause {
15
+ field: string;
16
+ condition: 'NOT_EQUAL_TO';
17
+ value: string[];
18
+ }
19
+ export interface InClause {
20
+ field: string;
21
+ condition: 'IN';
22
+ value: string[];
23
+ }
24
+ export declare type WhereClause = StartsWithClause | NotEqualToClause | InClause;
14
25
  export interface ListOptions {
15
26
  where?: Array<WhereClause>;
16
27
  cursor?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,eAAgB,MAAM,OAAO,MAAM,aAAa,OAAO;;;;;;;CAc1E,CAAC;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS,eAAgB,MAAM,WAAW,WAAW;;;;;;;;CAuBhE,CAAC;AAEH,eAAO,MAAM,mBAAmB,eAAgB,MAAM,WAAW,WAAW;;;;;;;;CAuB1E,CAAC;AAEH,eAAO,MAAM,QAAQ,eAAgB,MAAM,OAAO,MAAM,SAAS,GAAG,aAAa,OAAO;;;;;;;;;;CAyBtF,CAAC;AAEH,eAAO,MAAM,WAAW,eAAgB,MAAM,OAAO,MAAM,aAAa,OAAO;;;;;;;;;CAwB7E,CAAC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,eAAgB,MAAM,OAAO,MAAM,aAAa,OAAO;;;;;;;CAc1E,CAAC;AAEH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,cAAc,CAAC;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,oBAAY,WAAW,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,QAAQ,CAAC;AAEzE,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS,eAAgB,MAAM,WAAW,WAAW;;;;;;;;CAuBhE,CAAC;AAEH,eAAO,MAAM,mBAAmB,eAAgB,MAAM,WAAW,WAAW;;;;;;;;CAuB1E,CAAC;AAEH,eAAO,MAAM,QAAQ,eAAgB,MAAM,OAAO,MAAM,SAAS,GAAG,aAAa,OAAO;;;;;;;;;;CAyBtF,CAAC;AAEH,eAAO,MAAM,WAAW,eAAgB,MAAM,OAAO,MAAM,aAAa,OAAO;;;;;;;;;CAwB7E,CAAC"}
@@ -5,7 +5,7 @@ export declare class DefaultQueryBuilder implements QueryBuilder {
5
5
  private globalStorage;
6
6
  private queryOptions;
7
7
  constructor(globalStorage: Pick<GlobalStorage, 'list'>, queryOptions?: ListOptions);
8
- where(field: 'key', { condition, value }: Condition): QueryBuilder;
8
+ where(field: 'key', where: Condition): QueryBuilder;
9
9
  cursor(cursor: string): QueryBuilder;
10
10
  limit(limit: number): QueryBuilder;
11
11
  getOne(): Promise<Result | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"query-api.d.ts","sourceRoot":"","sources":["../src/query-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhF,qBAAa,mBAAoB,YAAW,YAAY;IAC1C,OAAO,CAAC,aAAa;IAA+B,OAAO,CAAC,YAAY;gBAAhE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,EAAU,YAAY,GAAE,WAAgB;IAEtG,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,SAAS,GAAG,YAAY;IAalE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAOpC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAO5B,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQrC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;CAGrC"}
1
+ {"version":3,"file":"query-api.d.ts","sourceRoot":"","sources":["../src/query-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhF,qBAAa,mBAAoB,YAAW,YAAY;IAC1C,OAAO,CAAC,aAAa;IAA+B,OAAO,CAAC,YAAY;gBAAhE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,EAAU,YAAY,GAAE,WAAgB;IAEtG,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY;IAYnD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAOpC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAO5B,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAQrC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;CAGrC"}
package/out/query-api.js CHANGED
@@ -6,13 +6,9 @@ class DefaultQueryBuilder {
6
6
  this.globalStorage = globalStorage;
7
7
  this.queryOptions = queryOptions;
8
8
  }
9
- where(field, { condition, value }) {
9
+ where(field, where) {
10
10
  return new DefaultQueryBuilder(this.globalStorage, Object.assign(Object.assign({}, this.queryOptions), { where: [
11
- {
12
- field,
13
- condition,
14
- value
15
- }
11
+ Object.assign({ field }, where)
16
12
  ] }));
17
13
  }
18
14
  cursor(cursor) {
@@ -10,10 +10,19 @@ export interface QueryApi {
10
10
  query(): QueryBuilder;
11
11
  }
12
12
  export declare type Value = string;
13
- export interface Predicate {
13
+ export interface StartsWith {
14
14
  condition: 'STARTS_WITH';
15
15
  value: Value;
16
16
  }
17
+ export interface NotEqualTo {
18
+ condition: 'NOT_EQUAL_TO';
19
+ value: Value[];
20
+ }
21
+ export interface In {
22
+ condition: 'IN';
23
+ value: Value[];
24
+ }
25
+ export declare type Predicate = StartsWith | NotEqualTo | In;
17
26
  export declare type Condition = Predicate;
18
27
  export interface QueryBuilder {
19
28
  where(field: 'key', condition: Condition): QueryBuilder;
@@ -1 +1 @@
1
- {"version":3,"file":"storage-adapter.d.ts","sourceRoot":"","sources":["../src/storage-adapter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC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,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/B,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/storage",
3
- "version": "1.1.0",
3
+ "version": "1.2.0-next.0",
4
4
  "description": "Forge Storage methods",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/node": "^12.12.63",
19
- "node-fetch": "^2.6.1",
20
- "@types/node-fetch": "^2.5.7"
19
+ "@types/node-fetch": "^2.5.7",
20
+ "node-fetch": "2.6.1"
21
21
  }
22
22
  }