@forge/usage 0.1.0-next.0 → 0.1.0-next.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @forge/usage
2
2
 
3
+ ## 0.1.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 255a038: `reportUsageCount` now returns the raw API response instead of throwing when the response is not ok.
8
+
3
9
  ## 0.1.0-next.0
4
10
 
5
11
  ### Minor Changes
package/out/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { FetchMethod } from '@forge/api';
1
+ import type { APIResponse, FetchMethod } from '@forge/api';
2
2
  export declare const USAGE_EVENTS_PATH = "/marketplace/metering/v1/usage-events";
3
3
  export declare const BILLABLE_ACTION = "api-call";
4
4
  export declare const DEFAULT_ACTOR = "ari:cloud:identity::user/atlassian-internal-system";
@@ -7,6 +7,6 @@ export type ReportUsageCountParams = {
7
7
  usageTimestamp: number | Date;
8
8
  user?: string;
9
9
  };
10
- export declare const createReportUsageCount: (requestAtlassian: FetchMethod) => (params: ReportUsageCountParams) => Promise<void>;
11
- export declare const reportUsageCount: (params: ReportUsageCountParams) => Promise<void>;
10
+ export declare const createReportUsageCount: (requestAtlassian: FetchMethod) => (params: ReportUsageCountParams) => Promise<APIResponse>;
11
+ export declare const reportUsageCount: (params: ReportUsageCountParams) => Promise<APIResponse>;
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,eAAO,MAAM,iBAAiB,0CAA0C,CAAC;AACzE,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,eAAO,MAAM,aAAa,uDAAuD,CAAC;AAKlF,MAAM,MAAM,sBAAsB,GAAG;IAEnC,UAAU,EAAE,MAAM,CAAC;IAEnB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AA4CF,eAAO,MAAM,sBAAsB,GAAI,kBAAkB,WAAW,MAC3B,QAAQ,sBAAsB,KAAG,OAAO,CAAC,IAAI,CA8BrF,CAAC;AAKF,eAAO,MAAM,gBAAgB,WAnCoB,sBAAsB,KAAG,OAAO,CAAC,IAAI,CAmCP,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3D,eAAO,MAAM,iBAAiB,0CAA0C,CAAC;AACzE,eAAO,MAAM,eAAe,aAAa,CAAC;AAC1C,eAAO,MAAM,aAAa,uDAAuD,CAAC;AAKlF,MAAM,MAAM,sBAAsB,GAAG;IAEnC,UAAU,EAAE,MAAM,CAAC;IAEnB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AA4CF,eAAO,MAAM,sBAAsB,GAAI,kBAAkB,WAAW,MAC3B,QAAQ,sBAAsB,KAAG,OAAO,CAAC,WAAW,CA0B5F,CAAC;AAKF,eAAO,MAAM,gBAAgB,WA/BoB,sBAAsB,KAAG,OAAO,CAAC,WAAW,CA+Bd,CAAC"}
package/out/index.js CHANGED
@@ -49,14 +49,11 @@ const createReportUsageCount = (requestAtlassian) => {
49
49
  applicableExemptionId: null,
50
50
  dimensions
51
51
  };
52
- const response = await requestAtlassian(exports.USAGE_EVENTS_PATH, {
52
+ return await requestAtlassian(exports.USAGE_EVENTS_PATH, {
53
53
  method: 'POST',
54
54
  headers: { 'content-type': 'application/json' },
55
55
  body: JSON.stringify(payload)
56
56
  });
57
- if (!response.ok) {
58
- throw new Error(`Failed to report usage: ${response.status} ${response.statusText}.`);
59
- }
60
57
  };
61
58
  };
62
59
  exports.createReportUsageCount = createReportUsageCount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/usage",
3
- "version": "0.1.0-next.0",
3
+ "version": "0.1.0-next.1",
4
4
  "description": "Forge Usage SDK",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",