Skip to content

Commit

Permalink
meta: deprecated old pkgs; add new
Browse files Browse the repository at this point in the history
- remove @urbit/api
- remove @urbit/http-api
- remove urbit-ob
- add @urbit/aura
- add urbit/js-http-api (via github repo)
- remove all references to @urbit/api
- replace with references to @/gear for most types, @urbit/aura for helpers, and js-http-api for network types (via the github repo; replace with npm package when published)
  • Loading branch information
tomholford committed May 25, 2023
1 parent 46f223d commit 34bd8e8
Show file tree
Hide file tree
Showing 54 changed files with 404 additions and 138 deletions.
85 changes: 34 additions & 51 deletions ui/package-lock.json

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

4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"@tlon/sigil-js": "^1.4.4",
"@tloncorp/mock-http-api": "^1.2.0",
"@types/lodash": "^4.14.172",
"@urbit/http-api": "^2.4.5-debug",
"@urbit/aura": "^1.0.0",
"@urbit/js-http-api": "git+https://github.com/urbit/js-http-api",
"big-integer": "^1.6.48",
"browser-cookies": "^1.2.0",
"classnames": "^2.3.1",
Expand All @@ -58,7 +59,6 @@
"react-hook-form": "^7.38.0",
"react-router-dom": "^5.2.0",
"slugify": "^1.6.0",
"urbit-ob": "^5.0.1",
"zustand": "^3.7.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Urbit, {
Thread,
UrbitHttpApiEvent,
UrbitHttpApiEventType,
} from '@urbit/http-api';
} from '@urbit/js-http-api';
import _ from 'lodash';
import { useLocalState } from '@/state/local';
import useSchedulerStore from './state/scheduler';
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/AppInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { chadIsRunning, Pike, Treaty } from '@urbit/api';
import { chadIsRunning, Pike, Treaty } from '@/gear';
import clipboardCopy from 'clipboard-copy';
import React, { FC, useCallback, useState } from 'react';
import cn from 'classnames';
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classNames from 'classnames';
import React, { useMemo } from 'react';
import { sigil, reactRenderer } from '@tlon/sigil-js';
import { deSig } from '@urbit/api';
import { deSig } from '@urbit/aura';
import { darken, lighten, parseToHsla } from 'color2k';
import { useCurrentTheme } from '../state/local';
import { normalizeUrbitColor } from '@/logic/utils';
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/DocketImage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { Docket } from '@urbit/api';
import { Docket } from '@/gear';
import cn from 'classnames';
import { useTileColor } from '../tiles/useTileColor';

Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/PikeMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Pike } from '@urbit/api';
import { Pike } from '@/gear';

import { Attribute } from './Attribute';

Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/ProviderLink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classNames from 'classnames';
import React from 'react';
import { Link, LinkProps } from 'react-router-dom';
import { Provider } from '@urbit/api';
import { Provider } from '@/gear';
import { ShipName } from './ShipName';
import { Avatar, AvatarSizes } from './Avatar';
import { Contact } from '@/types/contact';
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/ProviderList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { MouseEvent, useCallback } from 'react';
import { Provider } from '@urbit/api';
import { Provider } from '@/gear';
import classNames from 'classnames';
import { MatchItem } from '../nav/Nav';
import { useRecentsStore } from '../nav/search/Home';
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/ShipName.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cite } from '@urbit/api';
import { cite } from '@urbit/aura';
import React, { HTMLAttributes } from 'react';
import { useCalm } from '../state/settings';
import { useContact } from '../state/contact';
Expand Down
5 changes: 3 additions & 2 deletions ui/src/components/TreatyMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { daToDate, Treaty } from '@urbit/api';
import { daToUnix, parseDa } from '@urbit/aura'
import { Treaty } from '@/gear';

import moment from 'moment';
import { Attribute } from './Attribute';
Expand All @@ -15,7 +16,7 @@ export function TreatyMeta(props: { treaty: Treaty }) {
{ship}/{desk}
</Attribute>
<Attribute title="Last Software Update" attr="case">
{moment(daToDate(cass.da)).format('YYYY.MM.DD')}
{moment(daToUnix(parseDa(cass.da))).format('YYYY.MM.DD')}
</Attribute>
{meta.map((d) => (
<Attribute key={d} attr={d}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/gear/contacts/lib.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { Patp, Poke, Scry } from '../lib';
import { Patp, Poke, Scry } from '@urbit/js-http-api';
import {
Contact,
ContactUpdateAdd,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/gear/contacts/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Path, Patp } from '../lib';
import { Path, Patp } from '@urbit/js-http-api';
import { Resource } from '../groups';

export type ContactUpdate =
Expand Down
8 changes: 0 additions & 8 deletions ui/src/gear/deps.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@

declare module 'urbit-ob' {

/**
* Convert a @p-encoded string to a decimal-encoded string.
*/
function patp2dec(name: string): string
}
2 changes: 1 addition & 1 deletion ui/src/gear/docket/lib.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Poke, Scry } from '../lib';
import { Poke, Scry } from '@urbit/js-http-api';
import { Chad } from './types';

export function chadIsRunning(chad: Chad) {
Expand Down
5 changes: 3 additions & 2 deletions ui/src/gear/groups/lib.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { deSig } from '../index';
import { Enc, Path, Patp, PatpNoSig, Poke, Thread } from '../lib/types';
import { deSig } from '@urbit/aura';
import { Path, Patp, PatpNoSig, Poke, Thread } from '@urbit/js-http-api';
import { Enc } from '@/gear';
import { Group, GroupPolicy, GroupPolicyDiff, GroupUpdateAddMembers, GroupUpdateAddTag, GroupUpdateChangePolicy, GroupUpdateRemoveGroup, GroupUpdateRemoveMembers, GroupUpdateRemoveTag, Resource, RoleTags, Tag } from './types';
import { GroupUpdate } from './update';

Expand Down
3 changes: 2 additions & 1 deletion ui/src/gear/groups/update.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PatpNoSig, Path, ShipRank, Enc } from '../lib';
import { PatpNoSig, Path } from '@urbit/js-http-api';
import { ShipRank, Enc } from '@/gear';
import { roleTags } from './index';

export type RoleTags = typeof roleTags[number];
Expand Down
2 changes: 1 addition & 1 deletion ui/src/gear/groups/view.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { joinError, joinProgress, joinResult } from ".";
import {Patp} from "../lib";
import { Patp } from '@urbit/js-http-api';

export type JoinError = typeof joinError[number];

Expand Down
6 changes: 3 additions & 3 deletions ui/src/gear/hark/lib.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { BigInteger } from 'big-integer';

import { Poke } from '../lib/types';
import { Poke } from '@urbit/js-http-api';
import {
HarkBin,
HarkBinId,
HarkBody,
HarkLid,
HarkPlace
} from './types';
import { decToUd } from '../lib';
import { parseUd } from '@urbit/aura';

export const harkAction = <T>(data: T): Poke<T> => ({
app: 'hark-store',
Expand Down Expand Up @@ -39,7 +39,7 @@ export const actOnNotification = (
): Poke<unknown> =>
harkAction({
[frond]: {
time: decToUd(intTime.toString()),
time: parseUd(intTime.toString()),
bin
}
});
Expand Down
2 changes: 1 addition & 1 deletion ui/src/gear/hood/lib.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Poke, Scry } from '../lib';
import { Poke, Scry } from '@urbit/js-http-api';
import { Pike } from './types';

export const getPikes: Scry = {
Expand Down
2 changes: 2 additions & 0 deletions ui/src/gear/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export * as hood from './hood';
export * from './hood';
export * as docket from './docket';
export * from './docket';
export * as utils from './utils';
export * from './utils';

// TODO: Userspace Permissions
// export * from './permissions';
Expand Down
3 changes: 2 additions & 1 deletion ui/src/gear/invite/lib.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Poke, Serial } from "../lib";
import { Poke } from '@urbit/js-http-api';
import { Serial } from '@/gear';
import { InviteUpdate, InviteUpdateAccept, InviteUpdateDecline } from "./types";

export const inviteAction = <T extends InviteUpdate>(data: T): Poke<T> => ({
Expand Down
3 changes: 2 additions & 1 deletion ui/src/gear/invite/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Serial, PatpNoSig, Path } from '../lib';
import { PatpNoSig, Path } from '@urbit/js-http-api';
import { Serial } from '@/gear';
import { Resource } from "../groups";

export type InviteUpdate =
Expand Down
5 changes: 3 additions & 2 deletions ui/src/gear/metadata/lib.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Path, Poke, uxToHex, PatpNoSig } from '../lib';
import { parseUx } from '@urbit/aura';
import { Path, Poke, PatpNoSig } from '@urbit/js-http-api';
import { MdAppName, Association, Metadata, MetadataUpdate, MetadataUpdateAdd, MetadataUpdateRemove, MetadataEditField, MetadataUpdateEdit } from './types';

export const METADATA_UPDATE_VERSION = 2;
Expand Down Expand Up @@ -83,7 +84,7 @@ export const update = (
newMetadata: Partial<Metadata>
): Poke<MetadataUpdateAdd> => {
const metadata = { ...association.metadata, ...newMetadata };
metadata.color = uxToHex(metadata.color);
metadata.color = parseUx(metadata.color);
return metadataAction<MetadataUpdateAdd>({
add: {
group: association.group,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/gear/metadata/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Path, Patp } from '../lib';
import { Path, Patp } from '@urbit/js-http-api';

export type MdAppName = 'groups' | 'graph';

Expand Down
Loading

0 comments on commit 34bd8e8

Please sign in to comment.