@ja-platform/db 0.0.0-dev-20261028223022 → 0.0.0-stage

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +3 -0
  2. package/package.json +3 -52
  3. package/LICENSE +0 -521
  4. package/dist/@types/Schema.d.ts +0 -1
  5. package/dist/@types/app.d.ts +0 -12
  6. package/dist/@types/browser.d.ts +0 -31
  7. package/dist/@types/credentials/ApiCredentials.d.ts +0 -18
  8. package/dist/@types/credentials/MobileCredentials.d.ts +0 -22
  9. package/dist/@types/credentials/index.d.ts +0 -2
  10. package/dist/@types/database/Batch.d.ts +0 -61
  11. package/dist/@types/database/Collection.d.ts +0 -85
  12. package/dist/@types/database/Database.d.ts +0 -22
  13. package/dist/@types/database/DatabaseObject.d.ts +0 -51
  14. package/dist/@types/database/GenericDatabase.d.ts +0 -4
  15. package/dist/@types/database/JourneyAPIAdapter.d.ts +0 -45
  16. package/dist/@types/database/ObjectDisplayScope.d.ts +0 -22
  17. package/dist/@types/database/OnlineDB.d.ts +0 -8
  18. package/dist/@types/database/adapters/BaseAdapter.d.ts +0 -26
  19. package/dist/@types/database/adapters/DatabaseAdapter.d.ts +0 -22
  20. package/dist/@types/database/adapters/WebSQLAdapter.d.ts +0 -50
  21. package/dist/@types/index.d.ts +0 -2
  22. package/dist/@types/query/InternalQuery.d.ts +0 -17
  23. package/dist/@types/query/Query.d.ts +0 -133
  24. package/dist/@types/query/getPreloadRelationships.d.ts +0 -9
  25. package/dist/@types/query/queryOperations.d.ts +0 -87
  26. package/dist/@types/types/Attachment.d.ts +0 -104
  27. package/dist/@types/types/Location.d.ts +0 -18
  28. package/dist/@types/types/ObjectData.d.ts +0 -12
  29. package/dist/@types/types/TypeOperations.d.ts +0 -42
  30. package/dist/@types/utils/FunctionQueue.d.ts +0 -32
  31. package/dist/@types/utils/JourneyPromise.d.ts +0 -2
  32. package/dist/@types/utils/base64.d.ts +0 -4
  33. package/dist/@types/utils/retryableFetch.d.ts +0 -3
  34. package/dist/Schema.js +0 -6
  35. package/dist/Schema.js.map +0 -1
  36. package/dist/app.js +0 -30
  37. package/dist/app.js.map +0 -1
  38. package/dist/browser.js +0 -77
  39. package/dist/browser.js.map +0 -1
  40. package/dist/credentials/ApiCredentials.js +0 -61
  41. package/dist/credentials/ApiCredentials.js.map +0 -1
  42. package/dist/credentials/MobileCredentials.js +0 -73
  43. package/dist/credentials/MobileCredentials.js.map +0 -1
  44. package/dist/credentials/index.js +0 -19
  45. package/dist/credentials/index.js.map +0 -1
  46. package/dist/database/Batch.js +0 -189
  47. package/dist/database/Batch.js.map +0 -1
  48. package/dist/database/Collection.js +0 -69
  49. package/dist/database/Collection.js.map +0 -1
  50. package/dist/database/Database.js +0 -47
  51. package/dist/database/Database.js.map +0 -1
  52. package/dist/database/DatabaseObject.js +0 -646
  53. package/dist/database/DatabaseObject.js.map +0 -1
  54. package/dist/database/GenericDatabase.js +0 -3
  55. package/dist/database/GenericDatabase.js.map +0 -1
  56. package/dist/database/JourneyAPIAdapter.js +0 -357
  57. package/dist/database/JourneyAPIAdapter.js.map +0 -1
  58. package/dist/database/ObjectDisplayScope.js +0 -117
  59. package/dist/database/ObjectDisplayScope.js.map +0 -1
  60. package/dist/database/OnlineDB.js +0 -16
  61. package/dist/database/OnlineDB.js.map +0 -1
  62. package/dist/database/adapters/BaseAdapter.js +0 -66
  63. package/dist/database/adapters/BaseAdapter.js.map +0 -1
  64. package/dist/database/adapters/DatabaseAdapter.js +0 -3
  65. package/dist/database/adapters/DatabaseAdapter.js.map +0 -1
  66. package/dist/database/adapters/WebSQLAdapter.js +0 -343
  67. package/dist/database/adapters/WebSQLAdapter.js.map +0 -1
  68. package/dist/index.js +0 -20
  69. package/dist/index.js.map +0 -1
  70. package/dist/query/InternalQuery.js +0 -3
  71. package/dist/query/InternalQuery.js.map +0 -1
  72. package/dist/query/Query.js +0 -414
  73. package/dist/query/Query.js.map +0 -1
  74. package/dist/query/getPreloadRelationships.js +0 -45
  75. package/dist/query/getPreloadRelationships.js.map +0 -1
  76. package/dist/query/queryOperations.js +0 -678
  77. package/dist/query/queryOperations.js.map +0 -1
  78. package/dist/tsconfig.tsbuildinfo +0 -1
  79. package/dist/types/Attachment.js +0 -198
  80. package/dist/types/Attachment.js.map +0 -1
  81. package/dist/types/Location.js +0 -38
  82. package/dist/types/Location.js.map +0 -1
  83. package/dist/types/ObjectData.js +0 -3
  84. package/dist/types/ObjectData.js.map +0 -1
  85. package/dist/types/TypeOperations.js +0 -267
  86. package/dist/types/TypeOperations.js.map +0 -1
  87. package/dist/utils/FunctionQueue.js +0 -91
  88. package/dist/utils/FunctionQueue.js.map +0 -1
  89. package/dist/utils/JourneyPromise.js +0 -3
  90. package/dist/utils/JourneyPromise.js.map +0 -1
  91. package/dist/utils/base64.js +0 -40
  92. package/dist/utils/base64.js.map +0 -1
  93. package/dist/utils/retryableFetch.js +0 -57
  94. package/dist/utils/retryableFetch.js.map +0 -1
  95. package/readme.md +0 -37
@@ -1,104 +0,0 @@
1
- import 'isomorphic-fetch';
2
- export declare const toBackendData: unique symbol;
3
- export declare class Attachment {
4
- static isAttachment(attachment: unknown): attachment is Attachment;
5
- static create(options: {
6
- filename?: string;
7
- mediaType?: string;
8
- base64?: string;
9
- text?: string;
10
- data?: ArrayBuffer | Uint8Array;
11
- }): Promise<Attachment>;
12
- id: string;
13
- state: string;
14
- urls: {
15
- [index: string]: string;
16
- };
17
- private data?;
18
- private filename?;
19
- private _urlKey;
20
- constructor(attrs: string | {
21
- id?: string;
22
- state?: string;
23
- urls?: {
24
- [index: string]: string;
25
- };
26
- });
27
- toString(): string;
28
- /**
29
- * Returns a processed version of the attachment.
30
- *
31
- * If the specified process does not exist, present() will return false on the returned Attachment.
32
- *
33
- * @param process 'original', 'fullscreen' or 'thumbnail'.
34
- */
35
- processed(process: string): Attachment;
36
- /**
37
- * An attachment is present if its data is available.
38
- *
39
- * This can be either:
40
- * 1. An attachment created and uploaded by a different client.
41
- * 2. An attachment created locally, which may not be uploaded yet.
42
- *
43
- * @returns true if the attachment is present
44
- */
45
- present(): boolean;
46
- /**
47
- * @returns true if the attachment is uploaded, either locally or by a different client.
48
- */
49
- uploaded(): boolean;
50
- /**
51
- * Return the object as JSON, in the same format as given by the v4 API, with an additional `id` field.
52
- */
53
- toJSON(): {
54
- id: string;
55
- state: string;
56
- } & {
57
- [index: string]: string;
58
- };
59
- /**
60
- * Returns a the default downloadable URL for the attachment.
61
- *
62
- * For different variations of image attachments, use for example:
63
- * attachment.processed('thumbnail').url();
64
- *
65
- * @return the URL, or null if not present
66
- */
67
- url(): string;
68
- /**
69
- * Downloads the attachment data as a Buffer.
70
- *
71
- * Not available on mobile devices.
72
- *
73
- * @returns the data as a Buffer
74
- * @throws an error if the attachment is not present, or a network error occurs.
75
- */
76
- toBuffer(): Promise<Buffer>;
77
- /**
78
- * Downloads the attachment data as a ArrayBuffer.
79
- *
80
- *
81
- * @returns the data as an ArrayBuffer.
82
- * @throws an error if the attachment is not present, or a network error occurs.
83
- */
84
- toArrayBuffer(): Promise<ArrayBuffer>;
85
- /**
86
- * Downloads the attachment data as a string.
87
- *
88
- * Only use for text-based data, e.g. a CSV attachment.
89
- *
90
- * UTF-8 encoding is assumed.
91
- *
92
- * @returns the data as a string
93
- * @throws an error if the attachment is not present, or a network error occurs.
94
- */
95
- toText(): Promise<string>;
96
- /**
97
- * Downloads the attachment data as base64-encoded string.
98
- *
99
- * @returns the data
100
- * @throws an error if the attachment is not present, or a network error occurs.
101
- */
102
- toBase64(): Promise<string>;
103
- [toBackendData](): any;
104
- }
@@ -1,18 +0,0 @@
1
- export declare class Location {
2
- latitude: number;
3
- longitude: number;
4
- altitude: number;
5
- horizontal_accuracy: number;
6
- vertical_accuracy: number;
7
- timestamp: Date;
8
- constructor(attrs: {
9
- latitude?: number;
10
- longitude?: number;
11
- altitude?: number;
12
- horizontal_accuracy?: number;
13
- vertical_accuracy?: number;
14
- timestamp?: string | Date;
15
- });
16
- toString(): string;
17
- toJSON(): (string | number)[];
18
- }
@@ -1,12 +0,0 @@
1
- export interface PersistedObjectData {
2
- attributes: {
3
- [index: string]: any;
4
- };
5
- belongs_to: {
6
- [index: string]: string;
7
- };
8
- }
9
- export interface ObjectData extends PersistedObjectData {
10
- id: string;
11
- type: string;
12
- }
@@ -1,42 +0,0 @@
1
- import { Type } from '@ja-platform/parser-type-system';
2
- import { DateType, Day } from '@ja-platform/parser-schema';
3
- import type { Formatter } from '@ja-platform/parser-type-system';
4
- import { Attachment } from './Attachment';
5
- export interface ValueSerializeOptions {
6
- inlineAttachments?: boolean;
7
- }
8
- /**
9
- * Operations on runtime values, independent of descriptor traversal.
10
- */
11
- export declare class TypeOperations implements Formatter {
12
- readonly baseType: Type;
13
- constructor(baseType: Type);
14
- is(value: unknown): boolean;
15
- parse(value: unknown): any;
16
- format(value: any, format?: string): string;
17
- clone(value: any): any;
18
- valueFromJSON(data: any): any;
19
- valueToJSON(value: any, options?: ValueSerializeOptions): any;
20
- }
21
- export declare class DateOperations extends TypeOperations {
22
- readonly baseType: DateType;
23
- clone(value: any): Date | Day;
24
- valueFromJSON(value: any): Date | Day;
25
- valueToJSON(value: any): string;
26
- }
27
- export declare class DatetimeOperations extends TypeOperations {
28
- clone(value: any): Date;
29
- valueFromJSON(value: string): Date;
30
- valueToJSON(value: any): string;
31
- }
32
- export declare class AttachmentOperations extends TypeOperations {
33
- is(value: unknown): boolean;
34
- protected createValue(value: any): any;
35
- parse(value: unknown): any;
36
- valueFromJSON(value: any): any;
37
- valueToJSON(value: Attachment, options?: ValueSerializeOptions): any;
38
- }
39
- /**
40
- * Resolve value checks, parsing, copying, and wire conversion without replacing the original type.
41
- */
42
- export declare function operationsFor(type: Type): TypeOperations;
@@ -1,32 +0,0 @@
1
- export type PromiseFunction<T> = () => Promise<T>;
2
- /**
3
- * FunctionQueue maintains a queue of Promise-returning functions that
4
- * are executed sequentially (whereas normally they would execute their async code concurrently).
5
- */
6
- export declare class FunctionQueue {
7
- private queue;
8
- private multiCount;
9
- private exclusiveLock;
10
- constructor();
11
- /**
12
- * Place a function on the queue.
13
- * The function may either return a Promise or a value.
14
- * Return a Promise that is resolved with the result of the function.
15
- */
16
- enqueue<T>(promiseFn: PromiseFunction<T>, multi?: boolean): Promise<T>;
17
- /**
18
- * Place a function on the queue.
19
- * This function may execute in parallel with other "multi" functions, but not with other functions on the exclusive
20
- * queue.
21
- */
22
- enqueueMulti<T>(promiseFn: PromiseFunction<T>): Promise<T>;
23
- /**
24
- * Convert a normal Promise-returning function into one that is automatically enqueued.
25
- * The signature of the function stays the same - only the execution is potentially delayed.
26
- * The only exception is that if the function would have returned a scalar value, it now
27
- * returns a Promise.
28
- */
29
- qu<T>(fn: PromiseFunction<T>): () => Promise<T>;
30
- private _lockNext;
31
- private _tryNext;
32
- }
@@ -1,2 +0,0 @@
1
- type JourneyPromise<T> = Promise<T>;
2
- export { JourneyPromise, JourneyPromise as Promise };
@@ -1,4 +0,0 @@
1
- export declare var decode: (encodedData: string) => string;
2
- export declare var encode: (text: string) => string;
3
- export declare function datauri(mime: string, data: string): string;
4
- export declare function cleanDecode(encodedData: string): string;
@@ -1,3 +0,0 @@
1
- import 'isomorphic-fetch';
2
- import type { Response, RequestInit } from 'node-fetch';
3
- export declare const retryableFetch: (url: string, options: RequestInit, retriesLeft?: number) => Promise<Response>;
package/dist/Schema.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DBSchema = void 0;
4
- var parser_schema_1 = require("@ja-platform/parser-schema");
5
- Object.defineProperty(exports, "DBSchema", { enumerable: true, get: function () { return parser_schema_1.Schema; } });
6
- //# sourceMappingURL=Schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../src/Schema.ts"],"names":[],"mappings":";;;AAAA,4DAAgE;AAAvD,yGAAA,MAAM,OAAY","sourcesContent":["export { Schema as DBSchema } from '@ja-platform/parser-schema';\n"]}
package/dist/app.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Day = void 0;
18
- var parser_schema_1 = require("@ja-platform/parser-schema");
19
- Object.defineProperty(exports, "Day", { enumerable: true, get: function () { return parser_schema_1.Day; } });
20
- __exportStar(require("./database/Batch"), exports);
21
- __exportStar(require("./database/Collection"), exports);
22
- __exportStar(require("./database/DatabaseObject"), exports);
23
- __exportStar(require("./types/Location"), exports);
24
- __exportStar(require("./query/Query"), exports);
25
- __exportStar(require("./database/GenericDatabase"), exports);
26
- __exportStar(require("./database/adapters/DatabaseAdapter"), exports);
27
- __exportStar(require("./types/ObjectData"), exports);
28
- __exportStar(require("./database/Database"), exports);
29
- __exportStar(require("./types/Attachment"), exports);
30
- //# sourceMappingURL=app.js.map
package/dist/app.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4DAAiD;AAAxC,oGAAA,GAAG,OAAA;AAEZ,mDAAiC;AACjC,wDAAsC;AACtC,4DAA0C;AAC1C,mDAAiC;AACjC,gDAA8B;AAC9B,6DAA2C;AAC3C,sEAAoD;AACpD,qDAAmC;AACnC,sDAAoC;AACpC,qDAAmC","sourcesContent":["export { Day } from '@ja-platform/parser-schema';\n\nexport * from './database/Batch';\nexport * from './database/Collection';\nexport * from './database/DatabaseObject';\nexport * from './types/Location';\nexport * from './query/Query';\nexport * from './database/GenericDatabase';\nexport * from './database/adapters/DatabaseAdapter';\nexport * from './types/ObjectData';\nexport * from './database/Database';\nexport * from './types/Attachment';\nexport { Promise } from './utils/JourneyPromise';\n"]}
package/dist/browser.js DELETED
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Attachment = exports.ArrayType = exports.Type = exports.query = exports.database = exports.QueryType = exports.SchemaModelTypeFactory = exports.SchemaModelType = exports.Field = exports.Day = void 0;
40
- const database = __importStar(require("./database/Database"));
41
- exports.database = database;
42
- const query = __importStar(require("./query/queryOperations"));
43
- exports.query = query;
44
- // Convenience export
45
- var parser_schema_1 = require("@ja-platform/parser-schema");
46
- Object.defineProperty(exports, "Day", { enumerable: true, get: function () { return parser_schema_1.Day; } });
47
- Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return parser_schema_1.Field; } });
48
- Object.defineProperty(exports, "SchemaModelType", { enumerable: true, get: function () { return parser_schema_1.SchemaModelType; } });
49
- Object.defineProperty(exports, "SchemaModelTypeFactory", { enumerable: true, get: function () { return parser_schema_1.SchemaModelTypeFactory; } });
50
- Object.defineProperty(exports, "QueryType", { enumerable: true, get: function () { return parser_schema_1.QueryType; } });
51
- __exportStar(require("./credentials/ApiCredentials"), exports);
52
- __exportStar(require("./credentials/MobileCredentials"), exports);
53
- __exportStar(require("./Schema"), exports);
54
- var parser_type_system_1 = require("@ja-platform/parser-type-system");
55
- Object.defineProperty(exports, "Type", { enumerable: true, get: function () { return parser_type_system_1.Type; } });
56
- __exportStar(require("./types/TypeOperations"), exports);
57
- __exportStar(require("./types/ObjectData"), exports);
58
- var parser_type_system_2 = require("@ja-platform/parser-type-system");
59
- Object.defineProperty(exports, "ArrayType", { enumerable: true, get: function () { return parser_type_system_2.ArrayType; } });
60
- __exportStar(require("./types/Location"), exports);
61
- var Attachment_1 = require("./types/Attachment");
62
- Object.defineProperty(exports, "Attachment", { enumerable: true, get: function () { return Attachment_1.Attachment; } });
63
- __exportStar(require("./database/Batch"), exports);
64
- __exportStar(require("./database/Database"), exports);
65
- __exportStar(require("./database/Collection"), exports);
66
- __exportStar(require("./database/DatabaseObject"), exports);
67
- __exportStar(require("./database/ObjectDisplayScope"), exports);
68
- __exportStar(require("./database/adapters/BaseAdapter"), exports);
69
- __exportStar(require("./database/GenericDatabase"), exports);
70
- __exportStar(require("./database/JourneyAPIAdapter"), exports);
71
- __exportStar(require("./database/adapters/DatabaseAdapter"), exports);
72
- __exportStar(require("./database/adapters/WebSQLAdapter"), exports);
73
- __exportStar(require("./query/Query"), exports);
74
- __exportStar(require("./query/InternalQuery"), exports);
75
- __exportStar(require("./utils/base64"), exports);
76
- __exportStar(require("./utils/FunctionQueue"), exports);
77
- //# sourceMappingURL=browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,QAAQ,gDAA4B;QASvC,QAAQ;AARjB,MAAY,KAAK,oDAAgC;QAQ9B,KAAK;AANxB,qBAAqB;AACrB,4DAA4G;AAAnG,oGAAA,GAAG,OAAA;AAAE,sGAAA,KAAK,OAAA;AAAE,gHAAA,eAAe,OAAA;AAAE,uHAAA,sBAAsB,OAAA;AAAE,0GAAA,SAAS,OAAA;AAOvE,+DAA6C;AAC7C,kEAAgD;AAEhD,2CAAyB;AAEzB,sEAAuD;AAA9C,0GAAA,IAAI,OAAA;AACb,yDAAuC;AACvC,qDAAmC;AAEnC,sEAA4D;AAAnD,+GAAA,SAAS,OAAA;AAElB,mDAAiC;AACjC,iDAAgD;AAAvC,wGAAA,UAAU,OAAA;AAEnB,mDAAiC;AACjC,sDAAoC;AACpC,wDAAsC;AACtC,4DAA0C;AAC1C,gEAA8C;AAC9C,kEAAgD;AAChD,6DAA2C;AAC3C,+DAA6C;AAC7C,sEAAoD;AACpD,oEAAkD;AAElD,gDAA8B;AAC9B,wDAAsC;AAEtC,iDAA+B;AAC/B,wDAAsC","sourcesContent":["import * as database from './database/Database';\nimport * as query from './query/queryOperations';\n\n// Convenience export\nexport { Day, Field, SchemaModelType, SchemaModelTypeFactory, QueryType } from '@ja-platform/parser-schema';\n\n/**\n * @deprecated\n */\nexport { database, query };\n\nexport * from './credentials/ApiCredentials';\nexport * from './credentials/MobileCredentials';\n\nexport * from './Schema';\n\nexport { Type } from '@ja-platform/parser-type-system';\nexport * from './types/TypeOperations';\nexport * from './types/ObjectData';\n\nexport { ArrayType } from '@ja-platform/parser-type-system';\n\nexport * from './types/Location';\nexport { Attachment } from './types/Attachment';\n\nexport * from './database/Batch';\nexport * from './database/Database';\nexport * from './database/Collection';\nexport * from './database/DatabaseObject';\nexport * from './database/ObjectDisplayScope';\nexport * from './database/adapters/BaseAdapter';\nexport * from './database/GenericDatabase';\nexport * from './database/JourneyAPIAdapter';\nexport * from './database/adapters/DatabaseAdapter';\nexport * from './database/adapters/WebSQLAdapter';\n\nexport * from './query/Query';\nexport * from './query/InternalQuery';\n\nexport * from './utils/base64';\nexport * from './utils/FunctionQueue';\n\nexport { Promise } from './utils/JourneyPromise';\n"]}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ApiCredentials = void 0;
37
- const base64 = __importStar(require("../utils/base64"));
38
- class ApiCredentials {
39
- constructor(options) {
40
- this.baseUrl = options.baseUrl;
41
- if (!this.baseUrl.endsWith('/')) {
42
- this.baseUrl += '/';
43
- }
44
- if (options.token) {
45
- this.authorization = 'Token ' + options.token;
46
- }
47
- else {
48
- this.authorization = 'Basic ' + base64.encode(options.username + ':' + options.password);
49
- }
50
- }
51
- api4Url() {
52
- return this.baseUrl;
53
- }
54
- apiAuthHeaders() {
55
- return {
56
- Authorization: this.authorization
57
- };
58
- }
59
- }
60
- exports.ApiCredentials = ApiCredentials;
61
- //# sourceMappingURL=ApiCredentials.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ApiCredentials.js","sourceRoot":"","sources":["../../src/credentials/ApiCredentials.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,MAAM,4CAAwB;AAY1C;IAIE,YAAY,OAA6B;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,OAAO,IAAI,GAAG,CAAC;QACtB,CAAC;QAED,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,IAAI,CAAC,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC;QAChD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,cAAc;QACZ,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import * as base64 from '../utils/base64';\n\nexport interface ApiCredentialOptions {\n /**\n * \"https://run-<server>.journeyapps.com/api/v4/:accountId\"\n */\n baseUrl: string;\n token?: string;\n username?: string;\n password?: string;\n}\n\nexport class ApiCredentials {\n baseUrl: string;\n authorization: string;\n\n constructor(options: ApiCredentialOptions) {\n this.baseUrl = options.baseUrl;\n if (!this.baseUrl.endsWith('/')) {\n this.baseUrl += '/';\n }\n\n if (options.token) {\n this.authorization = 'Token ' + options.token;\n } else {\n this.authorization = 'Basic ' + base64.encode(options.username + ':' + options.password);\n }\n }\n\n api4Url() {\n return this.baseUrl;\n }\n\n apiAuthHeaders() {\n return {\n Authorization: this.authorization\n };\n }\n}\n"]}
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.MobileCredentials = void 0;
37
- const base64 = __importStar(require("../utils/base64"));
38
- class MobileCredentials {
39
- constructor(options) {
40
- this.baseUrl = options.baseUrl;
41
- this.accountId = options.accountId;
42
- this.enrollmentId = options.enrollmentId;
43
- this.authToken = options.authToken;
44
- this.userId = options.userId;
45
- }
46
- mobileUrl() {
47
- return this.baseUrl + 'mobile/';
48
- }
49
- toJSON() {
50
- var JSONObject = {
51
- baseUrl: this.baseUrl,
52
- accountId: this.accountId,
53
- enrollmentId: this.enrollmentId,
54
- authToken: this.authToken,
55
- userId: this.userId
56
- };
57
- return JSON.stringify(JSONObject);
58
- }
59
- api4Url() {
60
- return this.baseUrl + 'api/v4/' + this.accountId + '/';
61
- }
62
- basicAuth() {
63
- return 'Basic ' + base64.encode(this.enrollmentId + ':' + this.authToken);
64
- }
65
- apiAuthHeaders() {
66
- return {
67
- Authorization: this.basicAuth(),
68
- 'Journey-Authentication-Type': 'Device'
69
- };
70
- }
71
- }
72
- exports.MobileCredentials = MobileCredentials;
73
- //# sourceMappingURL=MobileCredentials.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MobileCredentials.js","sourceRoot":"","sources":["../../src/credentials/MobileCredentials.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,MAAM,4CAAwB;AAE1C;IAOE,YAAY,OAMX;QACC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC/B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;IAClC,CAAC;IAED,MAAM;QACJ,IAAI,UAAU,GAAG;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;IACzD,CAAC;IAED,SAAS;QACP,OAAO,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5E,CAAC;IAED,cAAc;QACZ,OAAO;YACL,aAAa,EAAE,IAAI,CAAC,SAAS,EAAE;YAC/B,6BAA6B,EAAE,QAAQ;SACxC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import * as base64 from '../utils/base64';\n\nexport class MobileCredentials {\n baseUrl: string;\n accountId: string;\n enrollmentId: string;\n authToken: string;\n userId: string;\n\n constructor(options: {\n baseUrl: string;\n accountId: string;\n enrollmentId: string;\n authToken: string;\n userId: string;\n }) {\n this.baseUrl = options.baseUrl;\n this.accountId = options.accountId;\n this.enrollmentId = options.enrollmentId;\n this.authToken = options.authToken;\n this.userId = options.userId;\n }\n\n mobileUrl() {\n return this.baseUrl + 'mobile/';\n }\n\n toJSON() {\n var JSONObject = {\n baseUrl: this.baseUrl,\n accountId: this.accountId,\n enrollmentId: this.enrollmentId,\n authToken: this.authToken,\n userId: this.userId\n };\n return JSON.stringify(JSONObject);\n }\n\n api4Url() {\n return this.baseUrl + 'api/v4/' + this.accountId + '/';\n }\n\n basicAuth() {\n return 'Basic ' + base64.encode(this.enrollmentId + ':' + this.authToken);\n }\n\n apiAuthHeaders() {\n return {\n Authorization: this.basicAuth(),\n 'Journey-Authentication-Type': 'Device'\n };\n }\n}\n"]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ApiCredentials"), exports);
18
- __exportStar(require("./MobileCredentials"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/credentials/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,sDAAoC","sourcesContent":["export * from './ApiCredentials';\nexport * from './MobileCredentials';\n"]}