Skip to content

Commit

Permalink
WIP: prototype full-text-search
Browse files Browse the repository at this point in the history
  • Loading branch information
justinfagnani committed Oct 13, 2022
1 parent 3e1eb52 commit 07ad0bf
Show file tree
Hide file tree
Showing 10 changed files with 327 additions and 37 deletions.
121 changes: 121 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 1 addition & 16 deletions packages/catalog-api/src/lib/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,8 @@ type Query {
Eventually this will have more query parameters, and use some sort of ranking
algorithm, otherwise the order will just be defined by the database
implementation.
NOT IMPLEMENTED
DO_NOT_LAUNCH
"""
elements(distTag: String = "latest", limit: Int): [CustomElement!]!

"""
Retrieves the custom element data for a single element.
NOT IMPLEMENTED
DO_NOT_LAUNCH
"""
element(
packageName: String!
elementName: String!
tag: String = "latest"
): CustomElement
elements(query: String, distTag: String = "latest", limit: Int): [CustomElement!]!
}

type Mutation {
Expand Down
2 changes: 2 additions & 0 deletions packages/catalog-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@
"@koa/router": "^12.0.0",
"@types/koa__router": "^12.0.0",
"@types/koa-bodyparser": "^4.3.8",
"@types/natural": "^5.1.1",
"@webcomponents/catalog-api": "0.0.0",
"@webcomponents/custom-elements-manifest-tools": "0.0.0",
"custom-elements-manifest": "^2.0.0",
"firebase": "^9.6.10",
"firebase-admin": "^11.0.0",
"graphql-helix": "^1.13.0",
"koa-bodyparser": "^4.3.0",
"natural": "^5.2.3",
"node-fetch": "^3.2.3",
"npm-registry-fetch": "^13.1.0",
"semver": "^7.3.7"
Expand Down
18 changes: 16 additions & 2 deletions packages/catalog-server/src/lib/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ export class Catalog {

console.log('Writing custom elements...');
await this.#repository.writeCustomElements(
packageName,
version,
packageVersionMetadata,
customElements,
versionDistTags,
author
Expand Down Expand Up @@ -307,11 +306,26 @@ export class Catalog {
return this.#repository.getPackageVersion(packageName, version);
}

/**
* Gets the custom elements for a package
*/
async getCustomElements(
packageName: string,
version: string,
tagName: string | undefined
): Promise<Array<CustomElement>> {
return this.#repository.getCustomElements(packageName, version, tagName);
}

async queryElements({
query,
distTag,
limit,
}: {
query?: string;
distTag?: string;
limit?: number;
}) {
return this.#repository.queryElements({query, distTag, limit});
}
}

0 comments on commit 07ad0bf

Please sign in to comment.