firestore-meilisearch 0.3.1 → 0.3.3
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/README.md +0 -1
- package/__tests__/adapter.test.ts +1 -1
- package/__tests__/functions.test.ts +1 -1
- package/__tests__/util.test.ts +1 -1
- package/lib/import/config.js +24 -1
- package/lib/import/index.js +26 -3
- package/lib/index.js +25 -2
- package/lib/meilisearch-adapter.js +24 -1
- package/lib/version.js +1 -1
- package/package.json +9 -3
- package/src/import/index.ts +2 -2
- package/src/version.ts +1 -1
- package/tsconfig.json +2 -1
package/README.md
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
<p align="center">
|
|
20
20
|
<a href="https://github.com/meilisearch/firestore-meilisearch/actions"><img src="https://github.com/meilisearch/firestore-meilisearch/workflows/Tests/badge.svg" alt="Test"></a>
|
|
21
21
|
<a href="https://github.com/meilisearch/firestore-meilisearch/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a>
|
|
22
|
-
<a href="https://ms-bors.herokuapp.com/repositories/8"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
|
|
23
22
|
</p>
|
|
24
23
|
|
|
25
24
|
<p align="center">⚡ The Meilisearch API extension written for Firebase</p>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, test, expect } from '@jest/globals'
|
|
2
|
-
import
|
|
2
|
+
import firebaseFunctionsTestInit from 'firebase-functions-test'
|
|
3
3
|
import { mockConsoleInfo } from './__mocks__/console'
|
|
4
4
|
import * as firestore from 'firebase-admin/firestore'
|
|
5
5
|
import {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
afterEach,
|
|
7
7
|
jest,
|
|
8
8
|
} from '@jest/globals'
|
|
9
|
-
import
|
|
9
|
+
import firebaseFunctionsTestInit from 'firebase-functions-test'
|
|
10
10
|
import mockedEnv from 'mocked-env'
|
|
11
11
|
import { mocked } from 'jest-mock'
|
|
12
12
|
import {
|
package/__tests__/util.test.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
afterEach,
|
|
7
7
|
jest,
|
|
8
8
|
} from '@jest/globals'
|
|
9
|
-
import
|
|
9
|
+
import firebaseFunctionsTestInit from 'firebase-functions-test'
|
|
10
10
|
import mockedEnv from 'mocked-env'
|
|
11
11
|
import { ChangeType, getChangedDocumentId, getChangeType } from '../src/util'
|
|
12
12
|
import defaultEnvironment from './data/environment'
|
package/lib/import/config.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.parseConfig = void 0;
|
|
4
27
|
const commander_1 = require("commander");
|
|
5
|
-
const inquirer = require("inquirer");
|
|
28
|
+
const inquirer = __importStar(require("inquirer"));
|
|
6
29
|
const FIRESTORE_VALID_CHARACTERS = /^[^/]+$/;
|
|
7
30
|
const FIRESTORE_COLLECTION_NAME_MAX_CHARS = 6144;
|
|
8
31
|
const PROJECT_ID_MAX_CHARS = 30;
|
package/lib/import/index.js
CHANGED
|
@@ -15,17 +15,40 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
22
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
23
|
+
}
|
|
24
|
+
Object.defineProperty(o, k2, desc);
|
|
25
|
+
}) : (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
o[k2] = m[k];
|
|
28
|
+
}));
|
|
29
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
30
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
31
|
+
}) : function(o, v) {
|
|
32
|
+
o["default"] = v;
|
|
33
|
+
});
|
|
34
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
18
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
const firebase_admin_1 = require("firebase-admin");
|
|
42
|
+
const firebase_admin_1 = __importStar(require("firebase-admin"));
|
|
20
43
|
const config_1 = require("./config");
|
|
21
|
-
const logs = require("../logs");
|
|
44
|
+
const logs = __importStar(require("../logs"));
|
|
22
45
|
const meilisearch_adapter_1 = require("../meilisearch-adapter");
|
|
23
46
|
const create_index_1 = require("../meilisearch/create-index");
|
|
24
47
|
const run = async () => {
|
|
25
48
|
// Retrieve all arguments from the commande line.
|
|
26
49
|
const config = await (0, config_1.parseConfig)();
|
|
27
50
|
// Initialize Firebase using the Google Credentials in the GOOGLE_APPLICATION_CREDENTIALS environment variable.
|
|
28
|
-
|
|
51
|
+
firebase_admin_1.default.initializeApp({
|
|
29
52
|
credential: firebase_admin_1.credential.applicationDefault(),
|
|
30
53
|
databaseURL: `https://${config.projectId}.firebaseio.com`,
|
|
31
54
|
});
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.indexingWorker = void 0;
|
|
4
27
|
/*
|
|
@@ -16,11 +39,11 @@ exports.indexingWorker = void 0;
|
|
|
16
39
|
* See the License for the specific language governing permissions and
|
|
17
40
|
* limitations under the License.
|
|
18
41
|
*/
|
|
19
|
-
const functions = require("firebase-functions");
|
|
42
|
+
const functions = __importStar(require("firebase-functions"));
|
|
20
43
|
const firebase_functions_1 = require("firebase-functions");
|
|
21
44
|
const create_index_1 = require("./meilisearch/create-index");
|
|
22
45
|
const util_1 = require("./util");
|
|
23
|
-
const logs = require("./logs");
|
|
46
|
+
const logs = __importStar(require("./logs"));
|
|
24
47
|
const meilisearch_adapter_1 = require("./meilisearch-adapter");
|
|
25
48
|
const config_1 = require("./config");
|
|
26
49
|
const validate_1 = require("./validate");
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.adaptDocumentForMeilisearch = exports.adaptFieldsForMeilisearch = exports.parseFieldsToIndex = exports.isAFieldToIndex = void 0;
|
|
4
|
-
const firestore = require("firebase-admin/firestore");
|
|
27
|
+
const firestore = __importStar(require("firebase-admin/firestore"));
|
|
5
28
|
const logs_1 = require("./logs");
|
|
6
29
|
/**
|
|
7
30
|
* Adapts GeoPoint Firestore instance to fit with Meilisearch geo point.
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firestore-meilisearch",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/meilisearch/firestore-meilisearch"
|
|
7
|
+
},
|
|
4
8
|
"scripts": {
|
|
5
9
|
"lint": "eslint .",
|
|
6
10
|
"lint:fix": "eslint . --fix",
|
|
@@ -44,11 +48,13 @@
|
|
|
44
48
|
"firebase-functions-test": "^3.0.0",
|
|
45
49
|
"jest": "^29.4.3",
|
|
46
50
|
"jest-mock": "^29.4.3",
|
|
47
|
-
"js-yaml": "^4.1.
|
|
51
|
+
"js-yaml": "^4.1.1",
|
|
48
52
|
"mocked-env": "^1.3.5",
|
|
49
53
|
"prettier": "^2.4.1",
|
|
50
54
|
"ts-jest": "^29.0.5",
|
|
51
55
|
"ts-node": "^10.2.1"
|
|
52
56
|
},
|
|
53
|
-
"bin":
|
|
57
|
+
"bin": {
|
|
58
|
+
"firestore-meilisearch": "lib/import/index.js"
|
|
59
|
+
}
|
|
54
60
|
}
|
package/src/import/index.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import admin, { credential, firestore } from 'firebase-admin'
|
|
20
20
|
import { DocumentSnapshot } from 'firebase-functions/lib/v1/providers/firestore'
|
|
21
21
|
import { CLIConfig, parseConfig } from './config'
|
|
22
22
|
import * as logs from '../logs'
|
|
@@ -29,7 +29,7 @@ const run = async () => {
|
|
|
29
29
|
const config: CLIConfig = await parseConfig()
|
|
30
30
|
|
|
31
31
|
// Initialize Firebase using the Google Credentials in the GOOGLE_APPLICATION_CREDENTIALS environment variable.
|
|
32
|
-
initializeApp({
|
|
32
|
+
admin.initializeApp({
|
|
33
33
|
credential: credential.applicationDefault(),
|
|
34
34
|
databaseURL: `https://${config.projectId}.firebaseio.com`,
|
|
35
35
|
})
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.3.
|
|
1
|
+
export const version = '0.3.3'
|