@salesforce/nimbus-plugin-lds 1.100.2

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.
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@salesforce/nimbus-plugin-lds",
3
+ "version": "1.100.2",
4
+ "license": "SEE LICENSE IN LICENSE.txt",
5
+ "description": "Nimbus plugins for LDS on Mobile native integrations: durable store, networking, and draft queue.",
6
+ "types": "dist/index.d.ts",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "files": [
10
+ "dist",
11
+ "sql"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "scripts": {
21
+ "prepare": "yarn build",
22
+ "clean": "rm -rf dist",
23
+ "build": "rollup --config rollup.config.js",
24
+ "test:unit": "NODE_ENV=production jest"
25
+ },
26
+ "devDependencies": {
27
+ "@rollup/plugin-wasm": "^5.2.0",
28
+ "@salesforce/lds-store-sql": "^1.100.2",
29
+ "@types/sql.js": "1.4.3",
30
+ "nimbus-types": "^2.0.0-alpha1",
31
+ "rollup-plugin-string": "^3.0.0",
32
+ "rollup-plugin-web-worker-loader": "^1.6.1",
33
+ "sql.js": "^1.7.0"
34
+ }
35
+ }
package/sql/240000.sql ADDED
@@ -0,0 +1,70 @@
1
+ -- The primary table for data in the DEFAULT segment
2
+ CREATE TABLE lds_data (
3
+ key TEXT PRIMARY KEY,
4
+ data TEXT NOT NULL,
5
+ metadata JSON
6
+ );
7
+
8
+ -- The primary table for data in segments other than DEFAULT
9
+ -- and which do not have a dedicated table
10
+ CREATE TABLE lds_internal (
11
+ namespace TEXT NOT NULL,
12
+ key TEXT NOT NULL,
13
+ data TEXT NOT NULL,
14
+ metadata JSON,
15
+ PRIMARY KEY (namespace, key)
16
+ );
17
+
18
+ -- The table for draft actions created by the draft-aware mobile environment
19
+ CREATE TABLE lds_env_drafts (
20
+ key TEXT PRIMARY KEY,
21
+ data TEXT NOT NULL
22
+ );
23
+
24
+ -- The table for draft local to server id mappings
25
+ CREATE TABLE lds_env_draft_id_map (
26
+ key TEXT PRIMARY KEY,
27
+ data TEXT NOT NULL
28
+ );
29
+
30
+ CREATE INDEX idx_lds_data_uiapi_record_id
31
+ ON lds_data (json_extract(data, '$.id'))
32
+ WHERE
33
+ key LIKE 'UiApi::RecordRepresentation:%'
34
+ AND json_extract(data, '$.id') IS NOT NULL;
35
+
36
+ CREATE INDEX idx_lds_data_uiapi_record_apiname
37
+ ON lds_data (json_extract(data, '$.apiName'))
38
+ WHERE
39
+ key LIKE 'UiApi::RecordRepresentation:%'
40
+ AND json_extract(data, '$.apiName') IS NOT NULL;
41
+
42
+ CREATE INDEX idx_lds_data_uiapi_objectinfo_apiname
43
+ ON lds_data (json_extract(data, '$.apiName'))
44
+ WHERE
45
+ key LIKE 'UiApi::ObjectInfoRepresentation:%'
46
+ AND json_extract(data, '$.apiName') IS NOT NULL;
47
+
48
+ CREATE INDEX idx_lds_data_uiapi_objectinfo_keyprefix
49
+ ON lds_data (json_extract(data, '$.keyPrefix'))
50
+ WHERE
51
+ key LIKE 'UiApi::ObjectInfoRepresentation:%'
52
+ AND json_extract(data, '$.keyPrefix') IS NOT NULL;
53
+
54
+ CREATE INDEX idx_lds_data_uiapi_serviceresource_relatedrecordid
55
+ ON lds_data (json_extract(data, '$.fields.RelatedRecordId.value'))
56
+ WHERE
57
+ key LIKE 'UiApi::ObjectInfoRepresentation:%'
58
+ AND json_extract(data, '$.apiName') = 'ServiceResource';
59
+
60
+ CREATE INDEX idx_lds_data_uiapi_assigned_resource_service_appointment_id
61
+ ON lds_data(json_extract(data, '$.fields.ServiceAppointmentId.value'))
62
+ WHERE
63
+ key LIKE 'UiApi::ObjectInfoRepresentation:%'
64
+ AND json_extract(data, '$.apiName') = 'AssignedResource';
65
+
66
+ CREATE INDEX idx_lds_data_uiapi_assigned_resource_service_resource_id
67
+ ON lds_data(json_extract(data, '$.fields.ServiceResourceId.value'))
68
+ WHERE
69
+ key LIKE 'UiApi::ObjectInfoRepresentation:%'
70
+ AND json_extract(data, '$.apiName') = 'AssignedResource';
package/sql/Readme.md ADDED
@@ -0,0 +1,15 @@
1
+ This folder holds the schema migrations for the LDS SqliteStore implementation.
2
+
3
+ Each migration file should use the following naming convention:
4
+
5
+ `<core release number><incrementing version number padded to three digits>`
6
+
7
+ e.g. `240000` -> `240001` -> `240002` -> `242000` -> `242001` and so on.
8
+
9
+ This easily lets us see in which core release schema changes were made. It's unlikely we
10
+ will make >1000 schema changes in any given core release.
11
+
12
+ An application should read its current schema version and execute any migration
13
+ scripts newer than the current version during initialization in numerically sorted
14
+ order. It should then set its schema version to the filename of the newest migration
15
+ file. In Sqlite this is typically done using `PRAGMA user_version = <the version>`.