Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into bugfix/adds_topic_rec…
Browse files Browse the repository at this point in the history
…ipients
  • Loading branch information
unamashana committed Aug 8, 2023
2 parents 505016a + d908ba7 commit 6a020d9
Show file tree
Hide file tree
Showing 18 changed files with 635 additions and 643 deletions.
9 changes: 0 additions & 9 deletions .changeset/forty-jeans-cough.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/lazy-kings-shave.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/mighty-dancers-pay.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/nasty-deers-jog.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/pretty-chairs-fly.md

This file was deleted.

8 changes: 0 additions & 8 deletions .changeset/small-penguins-film.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/warm-baboons-repair.md

This file was deleted.

43 changes: 31 additions & 12 deletions .github/actions/smoke-test/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83950,12 +83950,23 @@ function getOperations(document) {
}
return methods;
}
const headerMaskMap = {
'X-MAGICBELL-API-KEY': '$MAGICBELL_API_KEY',
'X-MAGICBELL-API-SECRET': '$MAGICBELL_API_SECRET',
'X-MAGICBELL-USER-EMAIL': '$MAGICBELL_USER_EMAIL',
'X-MAGICBELL-USER-EXTERNAL-ID': '$MAGICBELL_USER_EXTERNAL_ID',
'X-MAGICBELL-USER-HMAC': '$MAGICBELL_USER_HMAC',
};
function toCurl({ method, baseURL, url, data, headers }) {
return [
`curl -X ${method.toUpperCase()}`,
`${baseURL}/${url.replace(/^\//, '')}`,
Object.entries(headers)
.map(([key, value]) => `-H '${key}: ${value}'`)
.map(([key, value]) => {
// only replace the value with an env key if the header has a value, otherwise we can't debug missing headers.
value = value ? headerMaskMap[key.toUpperCase()] || value : value;
return `-H "${key}: ${value}"`;
})
.join(' '),
data && `-d '${JSON.stringify(data)}'`,
].join(' ');
Expand All @@ -83972,12 +83983,6 @@ async function request(operation, type, params = {}) {
if (isPublicApi(operation)) {
headers['origin'] = 'https://magicbell-smoke-test.example.com';
}
if (type === 'preflight') {
headers['access-control-request-method'] = operation.method;
headers['access-control-request-headers'] =
'content-type, origin, x-magicbell-api-key, x-magicbell-user-email, x-magicbell-user-hmac';
headers['origin'] = 'https://magicbell-smoke-test.example.com';
}
const config = {
baseURL: serverUrl,
method,
Expand All @@ -83992,6 +83997,13 @@ async function request(operation, type, params = {}) {
},
params,
};
if (type === 'preflight') {
config.headers['access-control-request-method'] = operation.method;
config.headers['access-control-request-headers'] =
'content-type, origin, x-magicbell-api-key, x-magicbell-user-email, x-magicbell-user-hmac';
config.headers['origin'] = 'https://magicbell-smoke-test.example.com';
delete config.data;
}
const response = await axios_default().request(config).catch((e) => {
console.log(`ERROR: request ${config.method} ${config.url} resulted in a network error:`, {
error: { type: e.constructor.name, name: e.name, message: e.message },
Expand All @@ -84002,7 +84014,7 @@ async function request(operation, type, params = {}) {
});
const duration = Date.now() - start;
const error = response.data?.errors?.[0]?.message;
return Object.assign(response, { duration, config: config, error });
return Object.assign(response, { duration, config, error });
}
function getByJsonPointer(obj, path) {
return path
Expand Down Expand Up @@ -84068,16 +84080,18 @@ function createTests(operations) {
list.parentTask = suites.tasks[suites.tasks.length - 1];
list.add({
title: 'HTTP 401: request without authentication headers return 401 unauthorized',
task: async () => {
task: async function () {
const res = await request(operation, 'no-headers');
this.requestConfig = res.config;
expect(res.status, res.error).equal(401);
expect(res.duration).lessThan(5000);
},
});
list.add({
title: 'HTTP 401: request with invalid auth headers returns 401 unauthorized',
task: async () => {
task: async function () {
const res = await request(operation, 'invalid-auth');
this.requestConfig = res.config;
expect(res.status, res.error).equal(401);
expect(res.duration).lessThan(5000);
},
Expand All @@ -84094,9 +84108,10 @@ function createTests(operations) {
list.add({
title: `HTTP ${code}: request with valid api key and payload returns expected response`,
skip: () => shouldSkip,
task: async () => {
task: async function () {
operation.path = getUrl(path);
const res = await request(operation, 'authenticated');
this.requestConfig = res.config;
expect(res.status, res.error).equal(code);
expect(res.duration).lessThan(5000);
if (isPublicApi(operation)) {
Expand Down Expand Up @@ -84127,9 +84142,10 @@ function createTests(operations) {
list.add({
title: `HTTP 200: options request returns cors headers`,
skip: () => shouldSkip,
task: async () => {
task: async function () {
operation.path = getUrl(path);
const res = await request(operation, 'preflight');
this.requestConfig = res.config;
expect(res.status, res.error).equal(200);
expect(res.duration).lessThan(5000);
// check cors headers
Expand Down Expand Up @@ -84211,6 +84227,9 @@ async function smoke_test_main() {
console.log(`${chalk.red('✖')} ${err.task.listr.parentTask.title}`);
console.log(` ${chalk.red('✖')} ${err.task.title}`);
console.log(` error: ${err.message}`);
if ('requestConfig' in err.task) {
console.log(` request: ${toCurl(err.task.requestConfig)}`);
}
}
process.exit(1);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/code/HighlightedCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function HighlightedCode({
<HighlightedCodeHeader title={title || language} code={code} />
) : null}
<pre
style={{ background: '#190b47' }}
style={{ background: '#262E45' }}
className={classNames(
'hljs font-mono p-6 text-white overflow-x-auto',
!hideHeader || noTopBorderRadius ? 'rounded-b-md' : 'rounded-md',
Expand Down
4 changes: 1 addition & 3 deletions docs/src/components/code/HighlightedCodeHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export default function HighlightedCodeHeader({ title, code }: Props) {
return (
<div
className="pl-6 px-3 rounded-t-md uppercase text-xs font-bold text-white flex items-center h-10"
style={{
background: '#140939',
}}
style={{ background: '#23283B' }}
>
<div className="flex-1">{title}</div>
<div className="border-l border-white/25 py-0.5 pl-2">
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/tabs/TabsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function TabsHeader({ tabs, children, currentTabIndex }: Props) {
return (
<div
className="px-3 py-1 rounded-t-md space-x-2 text-white flex items-center"
style={{ background: '#140939' }}
style={{ background: '#23283B' }}
>
<div className="flex-1">{tabs.map((tab, index) => children(tab, index))}</div>
<div className="border-l border-white/25 pl-2">
Expand Down
2 changes: 1 addition & 1 deletion docs/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
app2: '#1E212F',
bgDefault: '#23283B',
bgHover: '#21283E',
outlineDark: '#3F3566',
outlineDark: '#354061',
darkGradientStart: '#23283d40',
darkGradientEnd: '#1e212f0d',
borderMuted: '#354061',
Expand Down
44 changes: 44 additions & 0 deletions openapi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# openapi

## 1.2.0

### Minor Changes

- [#97](https://github.com/magicbell-io/public/pull/97) [`6fc587f`](https://github.com/magicbell-io/public/commit/6fc587f9b96864799f32fdf4a62fa3f07ab626fa) Thanks [@smeijer](https://github.com/smeijer)! - Remove the `total` and `total_pages` properties from the response of the following requests:

- `GET /broadcasts`.
- `GET /broadcasts/{broadcast-id}/notifications`.
- `GET /users`.

- [#114](https://github.com/magicbell-io/public/pull/114) [`0a379c8`](https://github.com/magicbell-io/public/commit/0a379c8c18ebd1ab867c14249c5a6707e7b90c18) Thanks [@smeijer](https://github.com/smeijer)! - Remove the beta flags from the broadcasts apis. This includes:

- `GET /broadcasts`
- `GET /broadcasts/{broadcast_id}`
- `GET /broadcasts/{broadcast_id}/notifications`

- [`621fd33`](https://github.com/magicbell-io/public/commit/621fd33336eb93a7e9dbb6dfb6514fe4cd98811c) Thanks [@smeijer](https://github.com/smeijer)! - Add endpoint to list notifications of a specific user

- `GET /users/{user_id}/notifications`

- [#115](https://github.com/magicbell-io/public/pull/115) [`a4ed9c4`](https://github.com/magicbell-io/public/commit/a4ed9c4dc8bdb94d81d0c2737bb75ca5336e1efb) Thanks [@smeijer](https://github.com/smeijer)! - Remove the beta flags from the import apis. This includes:

- `POST /imports`
- `GET /imports/{import_id}`

- [`223c025`](https://github.com/magicbell-io/public/commit/223c0250ac76f9e456f4a7454c8b38dc872b3ab0) Thanks [@smeijer](https://github.com/smeijer)! - Add endpoint to the list the device tokens registered for push notifications of a specific user.

- `GET /push_subscriptions`

- [#116](https://github.com/magicbell-io/public/pull/116) [`7f45ed2`](https://github.com/magicbell-io/public/commit/7f45ed2b1e2eac308a287f5d4aeefff4a6e37dcc) Thanks [@smeijer](https://github.com/smeijer)! - Remove the beta flags from the users push-subscriptions apis. This includes:

- `GET /users/{user_id}/push_subscriptions`
- `DELETE /users/{user_id}/push_subscriptions/{subscription_id}`

- [`9def653`](https://github.com/magicbell-io/public/commit/9def6536358f86cc87899ace03329b0806dc6ee2) Thanks [@smeijer](https://github.com/smeijer)! - add metrics endpoints:

- `GET /metrics`
- `GET /metrics/categories`
- `GET /metrics/topics`

### Patch Changes

- [#95](https://github.com/magicbell-io/public/pull/95) [`0089911`](https://github.com/magicbell-io/public/commit/0089911c9fb708011370d778df119a6951a1bc79) Thanks [@smeijer](https://github.com/smeijer)! - rename operation from users-fetch to users-get to match convention.

## 1.1.0

### Minor Changes
Expand Down
3 changes: 2 additions & 1 deletion openapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openapi",
"version": "1.1.0",
"version": "1.2.0",
"description": "An OpenAPI specification for the MagicBell API",
"repository": "https://github.com/magicbell-io/public/tree/main/openapi",
"author": "Stephan Meijer <[email protected]>",
Expand Down Expand Up @@ -32,6 +32,7 @@
"ajv-formats": "^2.1.1",
"ast-types": "^0.14.2",
"axios": "^0.27.2",
"better-ajv-errors": "^1.2.0",
"chai": "^4.3.6",
"dotenv": "^16.0.2",
"eslint": "^8.23.1",
Expand Down
Loading

0 comments on commit 6a020d9

Please sign in to comment.