Skip to content

Commit

Permalink
rename "Pkey" to "PKey"
Browse files Browse the repository at this point in the history
  • Loading branch information
mj3cheun committed Mar 15, 2024
1 parent 494bf51 commit 2e51e94
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions projects/client-api-react/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import * as gAPI from '@graphistry/client-api';
import { ajax, catchError, first, forkJoin, map, of, switchMap, tap } from '@graphistry/client-api'; // avoid explicit rxjs dep
import { bg } from './bg';
import { bindings, panelNames, calls } from './bindings.js';
import { Client as ClientBase, ClientPkey as ClientPkeyBase, selectionUpdates, subscribeLabels } from '@graphistry/client-api';
import { Client as ClientBase, ClientPKey as ClientPKeyBase, selectionUpdates, subscribeLabels } from '@graphistry/client-api';

export const Client = ClientBase;
export const ClientPkey = ClientPkeyBase;
export const ClientPKey = ClientPKeyBase;

//https://blog.logrocket.com/how-to-get-previous-props-state-with-react-hooks/
function usePrevious(value) {
Expand Down
8 changes: 4 additions & 4 deletions projects/client-api/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import shallowEqual from 'shallowequal';
import { Model } from '@graphistry/falcor-model-rxjs';
import { PostMessageDataSource } from '@graphistry/falcor-socket-datasource';
import { $ref, $atom, $value } from '@graphistry/falcor-json-graph';
import { Client as ClientBase, ClientPkey as ClientPkeyBase, Dataset as DatasetBase, File as FileBase, EdgeFile as EdgeFileBase, NodeFile as NodeFileBase } from '@graphistry/js-upload-api';
import { Client as ClientBase, ClientPKey as ClientPKeyBase, Dataset as DatasetBase, File as FileBase, EdgeFile as EdgeFileBase, NodeFile as NodeFileBase } from '@graphistry/js-upload-api';


const CLIENT_SUBSCRIPTION_API_VERSION = 1;
Expand Down Expand Up @@ -54,11 +54,11 @@ export class Client extends ClientBase {
}

/**
* Class wrapping @graphistry/js-upload-api::ClientPkey for client->server File and Dataset uploads using personal key authentication.
* Class wrapping @graphistry/js-upload-api::ClientPKey for client->server File and Dataset uploads using personal key authentication.
* @global
* @extends ClientPkeyBase
* @extends ClientPKeyBase
*/
export class ClientPkey extends ClientPkeyBase {
export class ClientPKey extends ClientPKeyBase {
/**
* Create a Client
* @constructor
Expand Down
16 changes: 8 additions & 8 deletions projects/js-upload-api/src/ClientPkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const AUTH_API_ENDPOINT = 'api/v2/auth/pkey/jwt/';
* ```
*/

export class ClientPkey extends AbstractClient {
export class ClientPKey extends AbstractClient {

public readonly personalKeyId: string;
private _personalKeySecret: string;
Expand Down Expand Up @@ -138,7 +138,7 @@ export class ClientPkey extends AbstractClient {
return false;
}

private getPkeyString(id: string, secret: string) {
private getPKeyString(id: string, secret: string) {
return `PersonalKey ${id}:${secret}`;
}

Expand Down Expand Up @@ -175,19 +175,19 @@ export class ClientPkey extends AbstractClient {
...(this.org ? {org_name: this.org} : {}),
},
{
"Authorization": this.getPkeyString(this.personalKeyId, this._personalKeySecret),
"Authorization": this.getPKeyString(this.personalKeyId, this._personalKeySecret),
...this.getBaseHeaders(),
}
);
// fallback to personal-only GET pkey auth if 405 (Method Not Allowed)
if(response.status === 405) {
if(this.org) {
console.warn('Host does not support org auth via pkey, use username/password auth instead');
console.warn('Host does not support org auth via PKey, use username/password auth instead');
}
response = await this.getToApi(
AUTH_API_ENDPOINT,
{
"Authorization": this.getPkeyString(this.personalKeyId, this._personalKeySecret),
"Authorization": this.getPKeyString(this.personalKeyId, this._personalKeySecret),
}
);
}
Expand Down Expand Up @@ -225,20 +225,20 @@ export class ClientPkey extends AbstractClient {
...(org ? {org_name: org} : {}),
},
{
"Authorization": this.getPkeyString(personalKeyId, personalKeySecret),
"Authorization": this.getPKeyString(personalKeyId, personalKeySecret),
...this.getBaseHeaders(),
},
`${protocol}://${host}/`
);
// fallback to personal-only GET pkey auth if 405 (Method Not Allowed)
if(response.status === 405) {
if(org) {
console.warn('Host does not support org auth via pkey, use username/password auth instead');
console.warn('Host does not support org auth via PKey, use username/password auth instead');
}
response = await this.getToApi(
AUTH_API_ENDPOINT,
{
"Authorization": this.getPkeyString(personalKeyId, personalKeySecret),
"Authorization": this.getPKeyString(personalKeyId, personalKeySecret),
},
`${protocol}://${host}/`
);
Expand Down
2 changes: 1 addition & 1 deletion projects/js-upload-api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
export { Client } from "./Client.js";
export { ClientPkey } from "./ClientPkey.js";
export { ClientPKey } from "./ClientPkey.js";
export { ClientType } from "./types.js";
export { FileType, File, EdgeFile, NodeFile } from "./File.js";
export { Dataset } from "./Dataset.js";
Expand Down
4 changes: 2 additions & 2 deletions projects/js-upload-api/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Client } from "./Client.js";
import { ClientPkey } from "./ClientPkey.js";
import { ClientPKey } from "./ClientPkey.js";

/**
* @internal
Expand All @@ -11,4 +11,4 @@ import { ClientPkey } from "./ClientPkey.js";
* A type including clients with all available authentication methods
*
*/
export type ClientType = Client | ClientPkey;
export type ClientType = Client | ClientPKey;
8 changes: 4 additions & 4 deletions projects/node-api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client as ClientBase, ClientPkey as ClientPkeyBase } from '@graphistry/js-upload-api';
import { Client as ClientBase, ClientPKey as ClientPKeyBase } from '@graphistry/js-upload-api';
import { version as VERSION } from './version.js';
import fetch from 'node-fetch-commonjs';

Expand Down Expand Up @@ -52,11 +52,11 @@ export class Client extends ClientBase {
}

/**
* Class wrapping @graphistry/js-upload-api::ClientPkey for client->server File and Dataset uploads using personal key authentication.
* Class wrapping @graphistry/js-upload-api::ClientPKey for client->server File and Dataset uploads using personal key authentication.
* @global
* @extends ClientPkeyBase
* @extends ClientPKeyBase
*/
export class ClientPkey extends ClientPkeyBase {
export class ClientPKey extends ClientPKeyBase {
/**
* Create a Client
* @constructor
Expand Down

0 comments on commit 2e51e94

Please sign in to comment.