Skip to content

Commit

Permalink
Replace @elastic/datemath with @opensearch/datemath (opensearch-proje…
Browse files Browse the repository at this point in the history
…ct#204)

* Replace @elastic/datemath with @opensearch/datemath

Signed-off-by: Matt Provost <provomat@amazon.com>

* Clean up

Signed-off-by: Matt Provost <provomat@amazon.com>

---------

Signed-off-by: Matt Provost <provomat@amazon.com>
  • Loading branch information
BSFishy authored and AMoo-Miki committed Jul 2, 2023
1 parent 7626786 commit a31bd01
Show file tree
Hide file tree
Showing 23 changed files with 708 additions and 62 deletions.
76 changes: 38 additions & 38 deletions i18ntokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@
"start": {
"line": 191,
"column": 8,
"index": 5650
"index": 5638
},
"end": {
"line": 193,
"column": 40,
"index": 5750
"index": 5738
}
},
"filepath": "src/components/bottom_bar/bottom_bar.tsx"
Expand All @@ -205,12 +205,12 @@
"start": {
"line": 217,
"column": 14,
"index": 6647
"index": 6635
},
"end": {
"line": 221,
"column": 16,
"index": 6920
"index": 6908
}
},
"filepath": "src/components/bottom_bar/bottom_bar.tsx"
Expand All @@ -223,12 +223,12 @@
"start": {
"line": 223,
"column": 14,
"index": 6953
"index": 6941
},
"end": {
"line": 226,
"column": 16,
"index": 7150
"index": 7138
}
},
"filepath": "src/components/bottom_bar/bottom_bar.tsx"
Expand Down Expand Up @@ -1861,12 +1861,12 @@
"start": {
"line": 146,
"column": 12,
"index": 4299
"index": 4302
},
"end": {
"line": 151,
"column": 62,
"index": 4513
"index": 4516
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1879,12 +1879,12 @@
"start": {
"line": 146,
"column": 12,
"index": 4299
"index": 4302
},
"end": {
"line": 151,
"column": 62,
"index": 4513
"index": 4516
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1897,12 +1897,12 @@
"start": {
"line": 170,
"column": 12,
"index": 5261
"index": 5264
},
"end": {
"line": 172,
"column": 43,
"index": 5365
"index": 5368
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1915,12 +1915,12 @@
"start": {
"line": 189,
"column": 8,
"index": 5904
"index": 5907
},
"end": {
"line": 192,
"column": 75,
"index": 6075
"index": 6078
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1933,12 +1933,12 @@
"start": {
"line": 210,
"column": 14,
"index": 6566
"index": 6569
},
"end": {
"line": 214,
"column": 16,
"index": 6757
"index": 6760
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1951,12 +1951,12 @@
"start": {
"line": 220,
"column": 12,
"index": 6907
"index": 6910
},
"end": {
"line": 224,
"column": 14,
"index": 7088
"index": 7091
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand Down Expand Up @@ -1987,12 +1987,12 @@
"start": {
"line": 194,
"column": 8,
"index": 5693
"index": 5696
},
"end": {
"line": 196,
"column": 46,
"index": 5792
"index": 5795
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2005,12 +2005,12 @@
"start": {
"line": 213,
"column": 12,
"index": 6419
"index": 6422
},
"end": {
"line": 215,
"column": 37,
"index": 6519
"index": 6522
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2023,12 +2023,12 @@
"start": {
"line": 226,
"column": 16,
"index": 6926
"index": 6929
},
"end": {
"line": 228,
"column": 49,
"index": 7039
"index": 7042
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2041,12 +2041,12 @@
"start": {
"line": 241,
"column": 16,
"index": 7523
"index": 7526
},
"end": {
"line": 243,
"column": 45,
"index": 7628
"index": 7631
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2059,12 +2059,12 @@
"start": {
"line": 261,
"column": 12,
"index": 8244
"index": 8247
},
"end": {
"line": 261,
"column": 76,
"index": 8308
"index": 8311
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2077,12 +2077,12 @@
"start": {
"line": 276,
"column": 12,
"index": 8820
"index": 8823
},
"end": {
"line": 276,
"column": 76,
"index": 8884
"index": 8887
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2095,12 +2095,12 @@
"start": {
"line": 290,
"column": 12,
"index": 9356
"index": 9359
},
"end": {
"line": 290,
"column": 74,
"index": 9418
"index": 9421
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2113,12 +2113,12 @@
"start": {
"line": 311,
"column": 14,
"index": 10196
"index": 10199
},
"end": {
"line": 311,
"column": 76,
"index": 10258
"index": 10261
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2131,12 +2131,12 @@
"start": {
"line": 318,
"column": 12,
"index": 10451
"index": 10454
},
"end": {
"line": 326,
"column": 14,
"index": 10725
"index": 10728
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand Down Expand Up @@ -2239,12 +2239,12 @@
"start": {
"line": 429,
"column": 14,
"index": 11289
"index": 11292
},
"end": {
"line": 432,
"column": 16,
"index": 11415
"index": 11418
}
},
"filepath": "src/components/date_picker/super_date_picker/super_date_picker.tsx"
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@
"@babel/preset-react": "^7.10.4",
"@babel/preset-typescript": "^7.12.1",
"@elastic/charts": "^30.2.0",
"@elastic/datemath": "^5.0.3",
"@elastic/eslint-config-kibana": "^0.15.0",
"@opensearch/datemath": "file:./packages/opensearch-datemath",
"@svgr/core": "^8.0.0",
"@svgr/plugin-svgo": "^8.0.1",
"@svgr/plugin-jsx": "^8.0.1",
Expand Down Expand Up @@ -251,7 +251,6 @@
"yo": "^4.3.1"
},
"peerDependencies": {
"@elastic/datemath": "^5.0.2",
"@types/react": "^16.9.34",
"@types/react-dom": "^16.9.6",
"moment": "^2.13.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/opensearch-datemath/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/tsconfig.json
/__tests__
62 changes: 62 additions & 0 deletions packages/opensearch-datemath/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import moment from 'moment';
export type Unit = 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'M' | 'y';

declare const datemath: {
unitsMap: {
[k in Unit]: {
weight: number;
type: 'calendar' | 'fixed' | 'mixed';
base: number;
};
};
units: Unit[];
unitsAsc: Unit[];
unitsDesc: Unit[];

/**
* Parses a string into a moment object. The string can be something like "now - 15m".
* @param options.forceNow If this optional parameter is supplied, "now" will be treated as this
* date, rather than the real "now".
*/
parse(
input: string,
options?: {
roundUp?: boolean;
forceNow?: Date;
momentInstance?: typeof moment;
}
): moment.Moment | undefined;
};

// eslint-disable-next-line import/no-default-export
export default datemath;
Loading

0 comments on commit a31bd01

Please sign in to comment.