-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
2,649 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
clients/algoliasearch-client-javascript/packages/client-composition/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"version": "0.0.1-alpha.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/algolia/algoliasearch-client-javascript.git" | ||
}, | ||
"type": "module", | ||
"license": "MIT", | ||
"author": "Algolia", | ||
"scripts": { | ||
"build": "yarn clean && yarn tsup && yarn rollup -c rollup.config.js", | ||
"clean": "rm -rf ./dist || true", | ||
"test:bundle": "publint . && attw --pack ." | ||
}, | ||
"name": "@algolia/client-composition", | ||
"description": "JavaScript client for client-composition", | ||
"exports": { | ||
".": { | ||
"node": { | ||
"types": { | ||
"import": "./dist/node.d.ts", | ||
"module": "./dist/node.d.ts", | ||
"require": "./dist/node.d.cts" | ||
}, | ||
"import": "./dist/builds/node.js", | ||
"module": "./dist/builds/node.js", | ||
"require": "./dist/builds/node.cjs" | ||
}, | ||
"worker": { | ||
"types": "./dist/fetch.d.ts", | ||
"default": "./dist/builds/fetch.js" | ||
}, | ||
"default": { | ||
"types": "./dist/browser.d.ts", | ||
"module": "./dist/builds/browser.js", | ||
"import": "./dist/builds/browser.js", | ||
"default": "./dist/builds/browser.umd.js" | ||
} | ||
}, | ||
"./src/*": "./src/*.ts" | ||
}, | ||
"jsdelivr": "./dist/builds/browser.umd.js", | ||
"unpkg": "./dist/builds/browser.umd.js", | ||
"react-native": "./dist/builds/browser.js", | ||
"files": [ | ||
"dist", | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"dependencies": { | ||
"@algolia/client-common": "5.12.0", | ||
"@algolia/requester-browser-xhr": "5.12.0", | ||
"@algolia/requester-node-http": "5.12.0", | ||
"@algolia/requester-fetch": "5.12.0" | ||
}, | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "0.16.4", | ||
"@types/node": "22.8.1", | ||
"publint": "0.2.12", | ||
"rollup": "4.24.2", | ||
"tsup": "8.3.5", | ||
"typescript": "5.6.3" | ||
}, | ||
"engines": { | ||
"node": ">= 14.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ApiError } from '@algolia/client-common'; | ||
import { compositionClient } from '@algolia/client-composition'; | ||
|
||
const appId = process.env.ALGOLIA_APPLICATION_ID || '**** APP_ID *****'; | ||
const apiKey = process.env.ALGOLIA_ADMIN_KEY || '**** ADMIN_KEY *****'; | ||
|
||
// Init client with appId and apiKey | ||
const client = compositionClient(appId, apiKey); | ||
|
||
async function testComposition() { | ||
try { | ||
const res = await client.listCompositions(); | ||
|
||
console.log(`[OK]`, res); | ||
} catch (e) { | ||
if (e instanceof ApiError) { | ||
return console.log(`[${e.status}] ${e.message}`, e.stackTrace, e); | ||
} | ||
|
||
console.log('[ERROR]', e); | ||
} | ||
} | ||
|
||
testComposition(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
description: Composition not found. | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../schemas/ErrorBase.yml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
compositionID: | ||
in: path | ||
name: compositionID | ||
description: Unique Composition ObjectID. | ||
required: true | ||
schema: | ||
$ref: '#/compositionObjectID' | ||
|
||
compositionObjectID: | ||
type: string | ||
description: Unique Composition ObjectID. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
action: | ||
type: string | ||
enum: | ||
- upsert | ||
- delete | ||
description: Type of Composition Batch operation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
title: getTaskResponse | ||
type: object | ||
additionalProperties: false | ||
properties: | ||
status: | ||
$ref: '../../../common/responses/common.yml#/taskStatus' | ||
required: | ||
- status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
hit: | ||
type: object | ||
description: | | ||
Search result. | ||
A hit is a record from your index, augmented with special attributes for highlighting, snippeting, and ranking. | ||
x-is-generic: true | ||
additionalProperties: true | ||
required: | ||
- objectID | ||
properties: | ||
objectID: | ||
$ref: '../../../common/parameters.yml#/objectID' | ||
_highlightResult: | ||
$ref: '../../../common/schemas/HighlightResult.yml#/highlightResultMap' | ||
_snippetResult: | ||
$ref: '../../../common/schemas/SnippetResult.yml#/snippetResultMap' | ||
_rankingInfo: | ||
$ref: '#/rankingInfo' | ||
_distinctSeqID: | ||
$ref: '../../../common/schemas/Hit.yml#/distinctSeqID' | ||
|
||
rankingInfo: | ||
allOf: | ||
- $ref: '../../../common/schemas/Hit.yml#/rankingInfo' | ||
- $ref: '#/compositionRankingInfo' | ||
|
||
compositionRankingInfo: | ||
type: object | ||
additionalProperties: false | ||
properties: | ||
composed: | ||
title: composedRankingInfo | ||
type: object | ||
additionalProperties: false | ||
properties: | ||
index: | ||
type: string | ||
inset: | ||
type: string | ||
required: | ||
- index | ||
- inset |
Oops, something went wrong.