Skip to content

Commit

Permalink
Add copyright headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
elle-j committed Aug 25, 2023
1 parent b2cc3b3 commit f25fabb
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

import { BSON } from "realm";

export const ATLAS_APP_ID = "YOUR_APP_ID";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

import Realm from "realm";

import { ATLAS_APP_ID } from "./config";
Expand Down
21 changes: 21 additions & 0 deletions examples/example-node-connection-and-error/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

import { register, logIn, logOut, openRealm } from "./realm-auth";
import { addDummyData, updateDummyData, deleteDummyData, getStore } from "./realm-query";

const exampleEmail = "john@doe.com";
const examplePassword = "123456";

/**
* Illustrates the flow of using a synced Realm.
*/
async function main(): Promise<void> {
let success = await register(exampleEmail, examplePassword);
if (!success) {
Expand Down
22 changes: 21 additions & 1 deletion examples/example-node-connection-and-error/src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
// This is meant to be replaced with a preferred logging implementation.
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

/**
* Logger - This is meant to be replaced with a preferred logging implementation.
*/
export const logger = {
info(message: string) {
console.info(new Date().toLocaleString(), '|', message);
Expand Down
18 changes: 18 additions & 0 deletions examples/example-node-connection-and-error/src/models/Kiosk.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

import Realm, { BSON, ObjectSchema } from "realm";

import { Product } from "./Product";
Expand Down
26 changes: 23 additions & 3 deletions examples/example-node-connection-and-error/src/models/Product.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

import { BSON, ObjectSchema } from "realm";

// Current information and inventory about a type of product in a particular store.
// (This is simplified to refer to a complete product (e.g. a sandwich, rather than
// e.g. bread, cheese, lettuce, etc.)
/**
* Current information and inventory about a type of product in a particular store.
* (This is simplified to refer to a complete product (e.g. a sandwich, rather than
* e.g. bread, cheese, lettuce, etc.)
*/
export class Product extends Realm.Object {
_id!: BSON.ObjectId;
storeId!: BSON.ObjectId;
Expand Down
18 changes: 18 additions & 0 deletions examples/example-node-connection-and-error/src/models/Store.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

import Realm, { BSON, ObjectSchema } from "realm";

import { Kiosk } from "./Kiosk";
Expand Down
18 changes: 18 additions & 0 deletions examples/example-node-connection-and-error/src/realm-auth.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

import process from "node:process";
import Realm, {
ClientResetMode,
Expand Down
18 changes: 18 additions & 0 deletions examples/example-node-connection-and-error/src/realm-query.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

import { BSON } from "realm";

import { SYNC_STORE_ID } from "./atlas-app-services/config";
Expand Down

0 comments on commit f25fabb

Please sign in to comment.